mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🐛 Fix issue that XML node changes incoming data #2762
This commit is contained in:
parent
92d3c1949e
commit
2cc1f58f46
|
@ -234,6 +234,7 @@ export class Xml implements INodeType {
|
||||||
|
|
||||||
|
|
||||||
let item: INodeExecutionData;
|
let item: INodeExecutionData;
|
||||||
|
const returnData: INodeExecutionData[] = [];
|
||||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -253,15 +254,15 @@ export class Xml implements INodeType {
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const json = await parser.parseStringPromise(item.json[dataPropertyName]);
|
const json = await parser.parseStringPromise(item.json[dataPropertyName]);
|
||||||
items[itemIndex] = { json };
|
returnData.push({ json });
|
||||||
} else if (mode === 'jsonToxml') {
|
} else if (mode === 'jsonToxml') {
|
||||||
const builder = new Builder(options);
|
const builder = new Builder(options);
|
||||||
|
|
||||||
items[itemIndex] = {
|
returnData.push({
|
||||||
json: {
|
json: {
|
||||||
[dataPropertyName]: builder.buildObject(items[itemIndex].json),
|
[dataPropertyName]: builder.buildObject(items[itemIndex].json),
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`);
|
throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,7 @@ export class Xml implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.prepareOutputData(items);
|
return this.prepareOutputData(returnData);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue