Skip to content

Commit

Permalink
fix(Microsoft Outlook Node): Download executes more than once per inc…
Browse files Browse the repository at this point in the history
…oming item (#8566)
  • Loading branch information
michael-radency authored Feb 7, 2024
1 parent 7531f34 commit 053fb5f
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function execute(this: IExecuteFunctions, index: number, items: INo
if (attachmentDetails.contentType) {
mimeType = attachmentDetails.contentType;
}
const fileName = attachmentDetails.name;
const fileName = attachmentDetails.name as string;

const response = await microsoftApiRequest.call(
this,
Expand All @@ -74,13 +74,17 @@ export async function execute(this: IExecuteFunctions, index: number, items: INo
Object.assign(newItem.binary!, items[index].binary);
}

items[index] = newItem;
const data = Buffer.from(response.body as string, 'utf8');
items[index].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
data as unknown as Buffer,
fileName as string,
newItem.binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
data,
fileName,
mimeType,
);

return items;
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(newItem),
{ itemData: { item: index } },
);

return executionData;
}

0 comments on commit 053fb5f

Please sign in to comment.