mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
fix(editor): Fix mapping with special characters (#5837)
* fix: Fix mapping with special characters * refactor: rename var * test: update more unit tests * test: update mapping test * test: update mapping test
This commit is contained in:
@@ -6,8 +6,11 @@ export function generatePath(root: string, path: Array<string | number>): string
|
||||
return `${accu}[${part}]`;
|
||||
}
|
||||
|
||||
if (part.includes('-') || part.includes(' ') || part.includes('.')) {
|
||||
return `${accu}["${part}"]`;
|
||||
const special = ['-', ' ', '.', "'", '"', '`', '[', ']', '{', '}', '(', ')', ':', ',', '?'];
|
||||
const hasSpecial = !!special.find((s) => part.includes(s));
|
||||
if (hasSpecial) {
|
||||
const escaped = part.replaceAll("'", "\\'");
|
||||
return `${accu}['${escaped}']`;
|
||||
}
|
||||
|
||||
return `${accu}.${part}`;
|
||||
|
||||
Reference in New Issue
Block a user