fix(HTML Node): Escape data path value in JSON Property (#8441)

This commit is contained in:
Michael Kret
2024-01-26 11:51:03 +00:00
committed by GitHub
parent 7c49004018
commit fc5c562785
3 changed files with 152 additions and 108 deletions

View File

@@ -326,3 +326,20 @@ export function preparePairedItemDataArray(
if (Array.isArray(pairedItem)) return pairedItem;
return [pairedItem];
}
export const sanitazeDataPathKey = (item: IDataObject, key: string) => {
if (item[key] !== undefined) {
return key;
}
if (
(key.startsWith("['") && key.endsWith("']")) ||
(key.startsWith('["') && key.endsWith('"]'))
) {
key = key.slice(2, -2);
if (item[key] !== undefined) {
return key;
}
}
return key;
};