fix(editor): Escape node names with quotes in autocomplete and drag'n'drop (#8663)

This commit is contained in:
Elias Meire
2024-02-21 10:43:34 +01:00
committed by GitHub
parent c346002cc6
commit 890c2bd52b
5 changed files with 35 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
import type { INodeProperties } from 'n8n-workflow';
import { getMappedResult, getMappedExpression } from '../mappingUtils';
import { getMappedResult, getMappedExpression, escapeMappingString } from '../mappingUtils';
const RLC_PARAM: INodeProperties = {
displayName: 'Base',
@@ -273,4 +273,12 @@ describe('Mapping Utils', () => {
);
});
});
describe('escapeMappingString', () => {
test.each([
{ input: 'Normal node name (here)', output: 'Normal node name (here)' },
{ input: "'Should es'ape quotes here'", output: "\\'Should es\\'ape quotes here\\'" },
])('should escape "$input" to "$output"', ({ input, output }) => {
expect(escapeMappingString(input)).toEqual(output);
});
});
});