Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/Model/SendSmtpEmailAttachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ public function listInvalidProperties()
{
$invalidProperties = [];

if (!is_null($this->container['content']) && !preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['content'])) {
$invalidProperties[] = "invalid value for 'content', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.";
if (
!is_null($this->container['content']) &&
!base64_encode(base64_decode($this->container['content'], true)) === $this->container['content']
) {
$invalidProperties[] = "Invalid value for 'content', must be base64 encoded";
}

return $invalidProperties;
Expand Down Expand Up @@ -264,8 +267,11 @@ public function getContent()
public function setContent($content)
{

if (!is_null($content) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $content))) {
throw new \InvalidArgumentException("invalid value for $content when calling SendSmtpEmailAttachment., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.");
if (
!is_null($this->container['content']) &&
!base64_encode(base64_decode($this->container['content'], true)) === $this->container['content']
) {
throw new \InvalidArgumentException("Invalid value for 'content', must be base64 encoded");
}

$this->container['content'] = $content;
Expand Down