Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-11-05 14:39:54 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-11-05 14:39:54 +0300
commit81cc78d714efc89fa74ecb2acdfd4040c1b32e3e (patch)
treecfc63ad4013b8573616e0dd101c489f053341b34 /lib/Attachment.php
parent26d8bb13f0a67539279abcdbf2888913aee2540b (diff)
Fall back to attachment name from content type if it's not set in content-disposition
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Attachment.php')
-rw-r--r--lib/Attachment.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Attachment.php b/lib/Attachment.php
index 768beed63..abec4a05f 100644
--- a/lib/Attachment.php
+++ b/lib/Attachment.php
@@ -74,6 +74,7 @@ class Attachment {
throw new DoesNotExistException('Unable to load the attachment.');
}
$fetch = $headers[$this->messageId];
+ /** @var \Horde_Mime_Headers $mimeHeaders */
$mimeHeaders = $fetch->getMimeHeader($this->attachmentId, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
$this->mimePart = new \Horde_Mime_Part();
@@ -87,13 +88,8 @@ class Attachment {
// Extract headers from part
$contentDisposition = $mimeHeaders->getValue('content-disposition', \Horde_Mime_Headers::VALUE_PARAMS);
- if (!is_null($contentDisposition)) {
- $vars = ['filename'];
- foreach ($contentDisposition as $key => $val) {
- if(in_array($key, $vars)) {
- $this->mimePart->setDispositionParameter($key, $val);
- }
- }
+ if (!is_null($contentDisposition) && isset($contentDisposition['filename'])) {
+ $this->mimePart->setDispositionParameter('filename', $contentDisposition['filename']);
} else {
$contentDisposition = $mimeHeaders->getValue('content-type', \Horde_Mime_Headers::VALUE_PARAMS);
$vars = ['name'];