Skip to content

Commit 46cf25a

Browse files
committed
fix: handle missing attachments in Outlook message conversion
Add fallback to empty array when iterating attachments in convertMessageToUploadObject to prevent TypeError if attachments key exists but value is null/undefined.
1 parent 6e06be3 commit 46cf25a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/email-client/outlook-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ class OutlookClient extends BaseClient {
20152015
case 'attachments': {
20162016
messageUploadObj.attachments = [];
20172017
let attachmentCounter = 0;
2018-
for (let attachment of emailObject.attachments) {
2018+
for (let attachment of emailObject.attachments || []) {
20192019
let attachmentEntry = {
20202020
'@odata.type': '#microsoft.graph.fileAttachment'
20212021
};

0 commit comments

Comments
 (0)