From 36e9a9c137aa71dbf05c4d90e4839dc4d4cced11 Mon Sep 17 00:00:00 2001 From: Siddharth Gelera Date: Mon, 10 Nov 2025 18:14:00 +0530 Subject: [PATCH 1/3] fix: reset TEMPLATE_VAR_PATTERN lastIndex in URL validation --- .../Collection/CollectionItem/GenerateCodeItem/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js index 728cb7a7b..1557b06f1 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js @@ -19,6 +19,7 @@ const TEMPLATE_VAR_PATTERN = /\{\{([^}]+)\}\}/g; const validateURLWithVars = (url) => { const isValid = isValidUrl(url); const hasMissingInterpolations = TEMPLATE_VAR_PATTERN.test(url); + TEMPLATE_VAR_PATTERN.lastIndex = 0; return isValid && !hasMissingInterpolations; }; From 914b85802408f637f9c3b7cc49d8743305f1c89c Mon Sep 17 00:00:00 2001 From: Siddharth Gelera Date: Mon, 10 Nov 2025 18:15:57 +0530 Subject: [PATCH 2/3] fix: update TEMPLATE_VAR_PATTERN to remove global flag --- .../Collection/CollectionItem/GenerateCodeItem/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js index 1557b06f1..d9b9a36bd 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js @@ -14,7 +14,7 @@ import { useSelector } from 'react-redux'; import { getAllVariables, getGlobalEnvironmentVariables } from 'utils/collections/index'; import { resolveInheritedAuth } from './utils/auth-utils'; -const TEMPLATE_VAR_PATTERN = /\{\{([^}]+)\}\}/g; +const TEMPLATE_VAR_PATTERN = /\{\{([^}]+)\}\}/; const validateURLWithVars = (url) => { const isValid = isValidUrl(url); From e1045372d5da1d5f9a84314efb5329f4b398a13b Mon Sep 17 00:00:00 2001 From: Siddharth Gelera Date: Mon, 10 Nov 2025 19:24:14 +0530 Subject: [PATCH 3/3] fix: reset TEMPLATE_VAR_PATTERN lastIndex in URL validatio --- .../Collection/CollectionItem/GenerateCodeItem/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js index d9b9a36bd..ea5939540 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index.js @@ -19,7 +19,6 @@ const TEMPLATE_VAR_PATTERN = /\{\{([^}]+)\}\}/; const validateURLWithVars = (url) => { const isValid = isValidUrl(url); const hasMissingInterpolations = TEMPLATE_VAR_PATTERN.test(url); - TEMPLATE_VAR_PATTERN.lastIndex = 0; return isValid && !hasMissingInterpolations; };