mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(Merge Node): Fix possible stack overflow (#19101)
This commit is contained in:
@@ -291,7 +291,7 @@ export class MergeV2 implements INodeType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const returnData: INodeExecutionData[] = [];
|
let returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
const mode = this.getNodeParameter('mode', 0) as string;
|
const mode = this.getNodeParameter('mode', 0) as string;
|
||||||
|
|
||||||
@@ -536,7 +536,7 @@ export class MergeV2 implements INodeType {
|
|||||||
output = [...output, ...unmatched1, ...unmatched2];
|
output = [...output, ...unmatched1, ...unmatched2];
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData.push(...output);
|
returnData = returnData.concat(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joinMode === 'keepNonMatches') {
|
if (joinMode === 'keepNonMatches') {
|
||||||
@@ -565,15 +565,21 @@ export class MergeV2 implements INodeType {
|
|||||||
|
|
||||||
if (joinMode === 'enrichInput1') {
|
if (joinMode === 'enrichInput1') {
|
||||||
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
||||||
returnData.push(...mergedEntries, ...addSuffixToEntriesKeys(matches.unmatched1, '1'));
|
returnData = returnData.concat(
|
||||||
|
mergedEntries,
|
||||||
|
addSuffixToEntriesKeys(matches.unmatched1, '1'),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(...mergedEntries, ...matches.unmatched1);
|
returnData = returnData.concat(mergedEntries, matches.unmatched1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
||||||
returnData.push(...mergedEntries, ...addSuffixToEntriesKeys(matches.unmatched2, '2'));
|
returnData = returnData.concat(
|
||||||
|
mergedEntries,
|
||||||
|
addSuffixToEntriesKeys(matches.unmatched2, '2'),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(...mergedEntries, ...matches.unmatched2);
|
returnData = returnData.concat(mergedEntries, matches.unmatched2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ export async function execute(
|
|||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
inputsData: INodeExecutionData[][],
|
inputsData: INodeExecutionData[][],
|
||||||
): Promise<INodeExecutionData[][]> {
|
): Promise<INodeExecutionData[][]> {
|
||||||
const returnData: INodeExecutionData[] = [];
|
let returnData: INodeExecutionData[] = [];
|
||||||
const advanced = this.getNodeParameter('advanced', 0) as boolean;
|
const advanced = this.getNodeParameter('advanced', 0) as boolean;
|
||||||
let matchFields;
|
let matchFields;
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ export async function execute(
|
|||||||
output = [...output, ...unmatched1, ...unmatched2];
|
output = [...output, ...unmatched1, ...unmatched2];
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData.push(...output);
|
returnData = returnData.concat(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joinMode === 'keepNonMatches') {
|
if (joinMode === 'keepNonMatches') {
|
||||||
@@ -403,15 +403,21 @@ export async function execute(
|
|||||||
|
|
||||||
if (joinMode === 'enrichInput1') {
|
if (joinMode === 'enrichInput1') {
|
||||||
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
||||||
returnData.push(...mergedEntries, ...addSuffixToEntriesKeys(matches.unmatched1, '1'));
|
returnData = returnData.concat(
|
||||||
|
mergedEntries,
|
||||||
|
addSuffixToEntriesKeys(matches.unmatched1, '1'),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(...mergedEntries, ...matches.unmatched1);
|
returnData = returnData.concat(mergedEntries, matches.unmatched1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
||||||
returnData.push(...mergedEntries, ...addSuffixToEntriesKeys(matches.unmatched2, '2'));
|
returnData = returnData.concat(
|
||||||
|
mergedEntries,
|
||||||
|
addSuffixToEntriesKeys(matches.unmatched2, '2'),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(...mergedEntries, ...matches.unmatched2);
|
returnData = returnData.concat(mergedEntries, matches.unmatched2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ async function executeSelectWithMappedPairedItems(
|
|||||||
|
|
||||||
for (const item of result) {
|
for (const item of result) {
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
returnData.push(...item.map((entry) => rowToExecutionData(entry)));
|
returnData.push.apply(returnData, item.map(rowToExecutionData));
|
||||||
} else if (typeof item === 'object') {
|
} else if (typeof item === 'object') {
|
||||||
returnData.push(rowToExecutionData(item));
|
returnData.push(rowToExecutionData(item));
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ export async function execute(
|
|||||||
input: i,
|
input: i,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
pairedItem.push(...pairedItems);
|
pairedItem.push.apply(pairedItem, pairedItems);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,10 @@ export async function execute(
|
|||||||
|
|
||||||
for (const item of result) {
|
for (const item of result) {
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
returnData.push(...item.map((json) => ({ json, pairedItem })));
|
returnData.push.apply(
|
||||||
|
returnData,
|
||||||
|
item.map((json) => ({ json, pairedItem })),
|
||||||
|
);
|
||||||
} else if (typeof item === 'object') {
|
} else if (typeof item === 'object') {
|
||||||
returnData.push({ json: item, pairedItem });
|
returnData.push({ json: item, pairedItem });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user