diff --git a/lib/filter-handler.js b/lib/filter-handler.js index f423b03d..05c29947 100644 --- a/lib/filter-handler.js +++ b/lib/filter-handler.js @@ -697,7 +697,6 @@ class FilterHandler { try { let { data } = await this.addMessage(messageOpts); - if (data) { filterResults.push({ mailbox: data.mailbox && data.mailbox.toString(), @@ -711,7 +710,14 @@ class FilterHandler { userData, response: 'Message stored as ' + data.id.toString(), filterResults, - attachments: (maildata && maildata.attachments) || [] + attachments: [].concat((maildata && maildata.attachments) || []).map(att => { + let binaryHash = prepared.mimeTree?.attachmentMap?.[att.id]; + let resp = Object.assign({}, att); // cheap copy + if (binaryHash) { + resp.encodedSha256 = binaryHash.toString('base64'); + } + return resp; + }) }, prepared: (!isEncrypted && {