From 4ce20a5b039fb32aec1b5eed90ac8d12a69d63ee Mon Sep 17 00:00:00 2001 From: arpitnath Date: Thu, 4 Jul 2024 19:49:51 +0530 Subject: [PATCH] fixes: import/export/clone/versioning for bracket notations references --- frontend/src/_stores/utils.js | 11 +++++++++++ server/src/helpers/import_export.helpers.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/frontend/src/_stores/utils.js b/frontend/src/_stores/utils.js index 2414cf8b80..95d778455a 100644 --- a/frontend/src/_stores/utils.js +++ b/frontend/src/_stores/utils.js @@ -443,10 +443,21 @@ export function createReferencesLookup(refState, forQueryParams = false, initalL return { suggestionList, hintsMap, resolvedRefs }; } +function containsBracketNotation(queryString) { + const bracketNotationRegex = /\[\s*['"][^'"]+['"]\s*\]/; + return bracketNotationRegex.test(queryString); +} + export function findAllEntityReferences(node, allRefs) { if (typeof node === 'object') { for (let key in node) { const value = node[key]; + if (typeof value === 'string' && containsBracketNotation(value)) { + //skip if the value is a bracket notation + + break; + } + if ( typeof value === 'string' && value.includes('{{') && diff --git a/server/src/helpers/import_export.helpers.ts b/server/src/helpers/import_export.helpers.ts index db9b02ddec..9269743e23 100644 --- a/server/src/helpers/import_export.helpers.ts +++ b/server/src/helpers/import_export.helpers.ts @@ -25,10 +25,22 @@ export function updateEntityReferences(node, resourceMapping: Record