mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 06:00:28 +01:00
Ticket system some fixes where the attachment filename could not be read
This commit is contained in:
parent
f0bebba1ff
commit
0eb3ba50f2
@ -60,6 +60,9 @@ class MailAttachmentData implements MailAttachmentInterface
|
|||||||
*/
|
*/
|
||||||
public static function fromMailMessagePart(MailMessagePartInterface $part): MailAttachmentData
|
public static function fromMailMessagePart(MailMessagePartInterface $part): MailAttachmentData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$isInline = false;
|
||||||
|
|
||||||
$encodingHeader = $part->getHeader('content-transfer-encoding');
|
$encodingHeader = $part->getHeader('content-transfer-encoding');
|
||||||
if ($encodingHeader === null) {
|
if ($encodingHeader === null) {
|
||||||
// Assume this is no error (?) throw new InvalidArgumentException('missing header: "Content-Transfer-Encoding"');
|
// Assume this is no error (?) throw new InvalidArgumentException('missing header: "Content-Transfer-Encoding"');
|
||||||
@ -112,7 +115,7 @@ class MailAttachmentData implements MailAttachmentInterface
|
|||||||
}
|
}
|
||||||
else if ($disposition == 'inline') {
|
else if ($disposition == 'inline') {
|
||||||
$isInline = true;
|
$isInline = true;
|
||||||
$filename = ""; // This is questionable
|
$filename = "OpenXE_file.inline";
|
||||||
}
|
}
|
||||||
else if (strpos($disposition,'attachment;\n') == 0) { // No filename, check for content type message/rfc822
|
else if (strpos($disposition,'attachment;\n') == 0) { // No filename, check for content type message/rfc822
|
||||||
|
|
||||||
@ -123,12 +126,12 @@ class MailAttachmentData implements MailAttachmentInterface
|
|||||||
$contenttype = $contenttypeHeader->getValue();
|
$contenttype = $contenttypeHeader->getValue();
|
||||||
|
|
||||||
if ($contenttype == 'message/rfc822') {
|
if ($contenttype == 'message/rfc822') {
|
||||||
$isInline = false;
|
|
||||||
$filename = 'ForwardedMessage.eml';
|
$filename = 'ForwardedMessage.eml';
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException(
|
/* throw new InvalidArgumentException(
|
||||||
sprintf('unexpected header value "Content-Disposition" = "%s"', $disposition)
|
sprintf('unexpected header value "Content-Disposition" = "%s"', $disposition)
|
||||||
);
|
);*/
|
||||||
|
$filename = "OpenXE_file.unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -155,9 +158,16 @@ class MailAttachmentData implements MailAttachmentInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = $part->getContent();
|
||||||
|
if ($content === null) { // This should not be
|
||||||
|
throw new InvalidArgumentException(
|
||||||
|
sprintf('content is null "%s"', print_r($part,true))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return new self(
|
return new self(
|
||||||
$filename,
|
$filename,
|
||||||
$part->getContent(),
|
$content,
|
||||||
$part->getContentType(),
|
$part->getContentType(),
|
||||||
$encoding,
|
$encoding,
|
||||||
$isInline,
|
$isInline,
|
||||||
|
@ -153,8 +153,9 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
|
|||||||
if ($encodingHeader === null ) {
|
if ($encodingHeader === null ) {
|
||||||
$result = $this->content;
|
$result = $this->content;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
$result = $this->decode($this->content, $encodingHeader->getValue());
|
$result = $this->decode($this->content, $encodingHeader->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
$charset = $this->getCharset();
|
$charset = $this->getCharset();
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ class ContentDisposition implements UnstructuredInterface
|
|||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
const MAX_PARAMETER_LENGTH = 76;
|
// const MAX_PARAMETER_LENGTH = 76; // This is the RECOMMENDATION
|
||||||
|
const MAX_PARAMETER_LENGTH = 996; // This is the LIMIT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
Loading…
Reference in New Issue
Block a user