fix(imap-indexer): fix fileContentHash error in imap indexer, check for attachmentInfo beforehand ZMS-186 (#756)

This commit is contained in:
NickOvt 2024-11-07 22:48:11 +02:00 committed by GitHub
parent 77600195f3
commit 7daa0e35d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -626,11 +626,12 @@ class Indexer {
mimeTree.attachmentMap[node.attachmentId] = id; mimeTree.attachmentMap[node.attachmentId] = id;
let attachmentInfo = maildata.attachments && maildata.attachments.find(a => a.id === node.attachmentId); // get reference to attachment info let attachmentInfo = maildata.attachments && maildata.attachments.find(a => a.id === node.attachmentId); // get reference to attachment info
if (attachmentInfo && node.body) { if (attachmentInfo && node.body) {
attachmentInfo.size = node.body.length; attachmentInfo.size = node.body.length;
} }
if (fileContentHash) { if (attachmentInfo && fileContentHash) {
attachmentInfo.fileContentHash = fileContentHash; attachmentInfo.fileContentHash = fileContentHash;
} }