diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2020-11-01 20:23:06 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-11-02 15:44:24 +0300 |
commit | 7c1d85f377c8ca669440e6754707515259a6e1a5 (patch) | |
tree | 5cfd7dde1ba8a243b2266123e6809af33dc3d47e | |
parent | 9dc8c167abf1eb729c98e197b0ef78a17156c78a (diff) |
Fixes "Save all to Files" function
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rwxr-xr-x | lib/Controller/MessagesController.php | 4 | ||||
-rw-r--r-- | src/service/AttachmentService.js | 1 | ||||
-rw-r--r-- | tests/Unit/Controller/MessagesControllerTest.php | 2 |
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 = [ [ |