Include attachment sha256 in the filtering response

This commit is contained in:
Andris Reinman 2023-08-10 13:35:59 +03:00
parent e8b2667533
commit 734b0134d6

View file

@ -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 && {