refactor: Unify binary-data assertion across all nodes (no-changelog) (#5624)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-06 17:33:32 +01:00
committed by GitHub
parent 01a2160b3b
commit 5eb0d52459
69 changed files with 411 additions and 1573 deletions

View File

@@ -84,20 +84,8 @@ export namespace SendInBlueNode {
const { binaryPropertyName } = dataPropertyList;
const dataMappingList = (binaryPropertyName as string).split(',');
for (const attachmentDataName of dataMappingList) {
const binaryPropertyAttachmentName = attachmentDataName;
const item = this.getInputData();
if (item.binary![binaryPropertyAttachmentName] === undefined) {
throw new NodeOperationError(
this.getNode(),
`Item has no binary property called "${binaryPropertyName}"`,
);
}
const bufferFromIncomingData = await this.helpers.getBinaryDataBuffer(
binaryPropertyAttachmentName,
);
const binaryData = this.helpers.assertBinaryData(attachmentDataName);
const bufferFromIncomingData = await this.helpers.getBinaryDataBuffer(attachmentDataName);
const {
data: content,
@@ -111,7 +99,7 @@ export namespace SendInBlueNode {
itemIndex,
mimeType,
fileExtension!,
fileName || item.binary!.data.fileName!,
fileName ?? binaryData.fileName!,
);
attachment.push({ content, name });