From 551f031e473b6f781e2bc6c4f52073643d890b70 Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Wed, 7 Feb 2024 12:45:38 +0200 Subject: [PATCH] :zap: fix --- .../messageAttachment/download.operation.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/nodes-base/nodes/Microsoft/Outlook/v2/actions/messageAttachment/download.operation.ts b/packages/nodes-base/nodes/Microsoft/Outlook/v2/actions/messageAttachment/download.operation.ts index 3c5d7d81a957c..7892b24ffaec8 100644 --- a/packages/nodes-base/nodes/Microsoft/Outlook/v2/actions/messageAttachment/download.operation.ts +++ b/packages/nodes-base/nodes/Microsoft/Outlook/v2/actions/messageAttachment/download.operation.ts @@ -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, @@ -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; }