mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -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;
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue