Skip to content

Commit

Permalink
Include attachment sha256 in the filtering response
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Aug 10, 2023
1 parent e8b2667 commit 734b013
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/filter-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@ class FilterHandler {

try {
let { data } = await this.addMessage(messageOpts);

if (data) {
filterResults.push({
mailbox: data.mailbox && data.mailbox.toString(),
Expand All @@ -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 && {
Expand Down

0 comments on commit 734b013

Please sign in to comment.