From 6bcdea4b4403d716b1d34602d57036ff670dcca1 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:20:16 -0500 Subject: [PATCH] Fix code scanning alert no. 2: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- frontend/src/utils/getQueryParam.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/getQueryParam.js b/frontend/src/utils/getQueryParam.js index 2885b5d1..5f1d0537 100644 --- a/frontend/src/utils/getQueryParam.js +++ b/frontend/src/utils/getQueryParam.js @@ -1,5 +1,5 @@ export default (name) => { - name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); + name = name.replace(/\[/g, '\\[').replace(/\]/g, '\\]'); const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); const results = regex.exec(window.location.hash); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));