Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Microsoft Outlook Node): Download executes more than once per incoming item #8566

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading