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
|
||||
{
|
||||
|
||||
$isInline = false;
|
||||
|
||||
$encodingHeader = $part->getHeader('content-transfer-encoding');
|
||||
if ($encodingHeader === null) {
|
||||
// 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') {
|
||||
$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
|
||||
|
||||
@ -123,12 +126,12 @@ class MailAttachmentData implements MailAttachmentInterface
|
||||
$contenttype = $contenttypeHeader->getValue();
|
||||
|
||||
if ($contenttype == 'message/rfc822') {
|
||||
$isInline = false;
|
||||
$filename = 'ForwardedMessage.eml';
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
/* throw new InvalidArgumentException(
|
||||
sprintf('unexpected header value "Content-Disposition" = "%s"', $disposition)
|
||||
);
|
||||
);*/
|
||||
$filename = "OpenXE_file.unknown";
|
||||
}
|
||||
}
|
||||
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(
|
||||
$filename,
|
||||
$part->getContent(),
|
||||
$content,
|
||||
$part->getContentType(),
|
||||
$encoding,
|
||||
$isInline,
|
||||
|
@ -153,8 +153,9 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
|
||||
if ($encodingHeader === null ) {
|
||||
$result = $this->content;
|
||||
}
|
||||
|
||||
else {
|
||||
$result = $this->decode($this->content, $encodingHeader->getValue());
|
||||
}
|
||||
|
||||
$charset = $this->getCharset();
|
||||
|
||||
|
@ -18,7 +18,8 @@ class ContentDisposition implements UnstructuredInterface
|
||||
*
|
||||
* @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
|
||||
|
Loading…
Reference in New Issue
Block a user