🐛 Fix issue that XML node changes incoming data #2762

This commit is contained in:
Jan Oberhauser 2022-02-04 12:16:34 +01:00
parent 92d3c1949e
commit 2cc1f58f46

View file

@ -234,6 +234,7 @@ export class Xml implements INodeType {
let item: INodeExecutionData;
const returnData: INodeExecutionData[] = [];
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
try {
@ -253,15 +254,15 @@ export class Xml implements INodeType {
// @ts-ignore
const json = await parser.parseStringPromise(item.json[dataPropertyName]);
items[itemIndex] = { json };
returnData.push({ json });
} else if (mode === 'jsonToxml') {
const builder = new Builder(options);
items[itemIndex] = {
returnData.push({
json: {
[dataPropertyName]: builder.buildObject(items[itemIndex].json),
},
};
});
} else {
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);
}
}