fix(core): Missing pairing info (#7326)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Michael Kret
2023-10-10 18:36:20 +03:00
committed by GitHub
parent 6479eb180f
commit e2c3c7aceb
52 changed files with 363 additions and 157 deletions

View File

@@ -9,6 +9,7 @@ import { NodeOperationError } from 'n8n-workflow';
import Parser from 'rss-parser';
import { URL } from 'url';
import { generatePairedItemData } from '../../utils/utilities';
// Utility function
@@ -64,6 +65,8 @@ export class RssFeedRead implements INodeType {
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const pairedItem = generatePairedItemData(this.getInputData().length);
try {
const url = this.getNodeParameter('url', 0) as string;
const options = this.getNodeParameter('options', 0);
@@ -97,19 +100,22 @@ export class RssFeedRead implements INodeType {
throw new NodeOperationError(this.getNode(), error as Error);
}
const returnData: IDataObject[] = [];
const returnData: INodeExecutionData[] = [];
// For now we just take the items and ignore everything else
if (feed.items) {
feed.items.forEach((item) => {
returnData.push(item);
returnData.push({
json: item,
pairedItem,
});
});
}
return [this.helpers.returnJsonArray(returnData)];
return [returnData];
} catch (error) {
if (this.continueOnFail()) {
return [[{ json: { error: error.message } }]];
return [[{ json: { error: error.message }, pairedItem }]];
}
throw error;
}