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>2020-01-24 16:36:29 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-01-24 16:52:07 +0300
commit7942f00f94e236e9bbcf4ce01fa19e46c6de1d80 (patch)
treee4f53ca6c90a4db3c2df75ddf4fbd9a7c862c36e /lib/Controller/MessagesController.php
parent9f254d8a7fd5f64b1ca1169915ba7c5212dafd79 (diff)
Show embedded messages as attachments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Controller/MessagesController.php')
-rwxr-xr-xlib/Controller/MessagesController.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php
index 22b5d7b03..804022b96 100755
--- a/lib/Controller/MessagesController.php
+++ b/lib/Controller/MessagesController.php
@@ -292,8 +292,21 @@ class MessagesController extends Controller {
$attachment = $mailBox->getAttachment($messageId, $attachmentId);
+ // Body party and embedded messages do not have a name
+ if ($attachment->getName() === null) {
+ return new AttachmentDownloadResponse(
+ $attachment->getContents(),
+ $this->l10n->t('Embedded message %s', [
+ $attachmentId,
+ ]) . '.eml',
+ $attachment->getType()
+ );
+ }
return new AttachmentDownloadResponse(
- $attachment->getContents(), $attachment->getName(), $attachment->getType());
+ $attachment->getContents(),
+ $attachment->getName(),
+ $attachment->getType()
+ );
}
/**
@@ -452,7 +465,7 @@ class MessagesController extends Controller {
* @return boolean
*/
private function attachmentIsCalendarEvent(array $attachment): bool {
- return in_array($attachment['mime'], ['text/calendar', 'application/ics'], true);
+ return in_array($attachment['mime'], ['text/calendar', 'application/ics'], true);
}
}