mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Microsoft Outlook Node): Download executes more than once per incoming item (#8566)
This commit is contained in:
parent
7531f34386
commit
053fb5ff7a
|
@ -49,7 +49,7 @@ export async function execute(this: IExecuteFunctions, index: number, items: INo
|
||||||
if (attachmentDetails.contentType) {
|
if (attachmentDetails.contentType) {
|
||||||
mimeType = attachmentDetails.contentType;
|
mimeType = attachmentDetails.contentType;
|
||||||
}
|
}
|
||||||
const fileName = attachmentDetails.name;
|
const fileName = attachmentDetails.name as string;
|
||||||
|
|
||||||
const response = await microsoftApiRequest.call(
|
const response = await microsoftApiRequest.call(
|
||||||
this,
|
this,
|
||||||
|
@ -74,13 +74,17 @@ export async function execute(this: IExecuteFunctions, index: number, items: INo
|
||||||
Object.assign(newItem.binary!, items[index].binary);
|
Object.assign(newItem.binary!, items[index].binary);
|
||||||
}
|
}
|
||||||
|
|
||||||
items[index] = newItem;
|
|
||||||
const data = Buffer.from(response.body as string, 'utf8');
|
const data = Buffer.from(response.body as string, 'utf8');
|
||||||
items[index].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
|
newItem.binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
|
||||||
data as unknown as Buffer,
|
data,
|
||||||
fileName as string,
|
fileName,
|
||||||
mimeType,
|
mimeType,
|
||||||
);
|
);
|
||||||
|
|
||||||
return items;
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(newItem),
|
||||||
|
{ itemData: { item: index } },
|
||||||
|
);
|
||||||
|
|
||||||
|
return executionData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue