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

@@ -50,6 +50,7 @@ import { useRootStore } from '@/stores/n8nRoot.store';
import { useNDVStore } from '@/stores/ndv.store';
import { useRouter } from 'vue-router';
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
import { escapeMappingString } from '@/utils/mappingUtils';
// Node types that should not be displayed in variable selector
const SKIPPED_NODE_TYPES = [STICKY_NODE_TYPE];
@@ -398,7 +399,9 @@ export default defineComponent({
// Get json data
if (outputData.hasOwnProperty('json')) {
const jsonPropertyPrefix = useShort ? '$json' : `$('${nodeName}').item.json`;
const jsonPropertyPrefix = useShort
? '$json'
: `$('${escapeMappingString(nodeName)}').item.json`;
const jsonDataOptions: IVariableSelectorOption[] = [];
for (const propertyName of Object.keys(outputData.json)) {
@@ -423,7 +426,9 @@ export default defineComponent({
// Get binary data
if (outputData.hasOwnProperty('binary')) {
const binaryPropertyPrefix = useShort ? '$binary' : `$('${nodeName}').item.binary`;
const binaryPropertyPrefix = useShort
? '$binary'
: `$('${escapeMappingString(nodeName)}').item.binary`;
const binaryData = [];
let binaryPropertyData = [];
@@ -537,7 +542,7 @@ export default defineComponent({
returnData.push({
name: key,
key: `$('${nodeName}').context["${key}"]`,
key: `$('${escapeMappingString(nodeName)}').context['${escapeMappingString(key)}']`,
// @ts-ignore
value: nodeContext[key],
});
@@ -793,7 +798,12 @@ export default defineComponent({
{
name: this.$locale.baseText('variableSelector.parameters'),
options: this.sortOptions(
this.getNodeParameters(nodeName, `$('${nodeName}').params`, undefined, filterText),
this.getNodeParameters(
nodeName,
`$('${escapeMappingString(nodeName)}').params`,
undefined,
filterText,
),
),
} as IVariableSelectorOption,
];