diff options
Diffstat (limited to 'lib/Controller/MessagesController.php')
-rwxr-xr-x | lib/Controller/MessagesController.php | 17 |
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); } } |