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:
-rwxr-xr-xlib/Controller/MessagesController.php4
-rw-r--r--src/service/AttachmentService.js1
-rw-r--r--tests/Unit/Controller/MessagesControllerTest.php2
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php
index b0188a5a5..b9882970b 100755
--- a/lib/Controller/MessagesController.php
+++ b/lib/Controller/MessagesController.php
@@ -462,7 +462,7 @@ class MessagesController extends Controller {
if ($attachmentId === '0') {
// Save all attachments
/* @var $m IMAPMessage */
- $m = $folder->getMessage($id);
+ $m = $folder->getMessage($message->getUid());
$attachmentIds = array_map(function ($a) {
return $a['id'];
}, $m->attachments);
@@ -471,7 +471,7 @@ class MessagesController extends Controller {
}
foreach ($attachmentIds as $aid) {
- $attachment = $folder->getAttachment($message->getUid(), $attachmentId);
+ $attachment = $folder->getAttachment($message->getUid(), $aid);
$fileName = $attachment->getName() ?? $this->l10n->t('Embedded message %s', [
$aid,
diff --git a/src/service/AttachmentService.js b/src/service/AttachmentService.js
index 7bfe27455..661919a6e 100644
--- a/src/service/AttachmentService.js
+++ b/src/service/AttachmentService.js
@@ -37,6 +37,7 @@ export function saveAttachmentToFiles(id, attachmentId, directory) {
}
export function saveAttachmentsToFiles(id, directory) {
+ // attachmentId = 0 means 'all attachments' (see MessageController.php::saveAttachement)
return saveAttachmentToFiles(id, 0, directory)
}
diff --git a/tests/Unit/Controller/MessagesControllerTest.php b/tests/Unit/Controller/MessagesControllerTest.php
index 02907d18a..6636bfaa1 100644
--- a/tests/Unit/Controller/MessagesControllerTest.php
+++ b/tests/Unit/Controller/MessagesControllerTest.php
@@ -363,7 +363,7 @@ class MessagesControllerTest extends TestCase {
->will($this->returnValue($this->mailbox));
$this->mailbox->expects($this->once())
->method('getMessage')
- ->with($id)
+ ->with($uid)
->will($this->returnValue($this->message));
$this->message->attachments = [
[