Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From parameter option added to BYOR data convert #818

Merged
merged 14 commits into from
Dec 16, 2024
Merged

From parameter option added to BYOR data convert #818

merged 14 commits into from
Dec 16, 2024

Conversation

dkjang
Copy link
Contributor

@dkjang dkjang commented Dec 16, 2024

No description provided.

@dkjang dkjang added this pull request to the merge queue Dec 16, 2024
Merged via the queue into master with commit 0ba4e54 Dec 16, 2024
1 check passed
@dkjang dkjang deleted the dk-api-test branch December 16, 2024 17:48
@@ -72,6 +72,16 @@
return string.slice(0, -1)
}

let getParameterByName = function (name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix AI 23 days ago

To fix the problem, we need to ensure that backslashes are also escaped in the name parameter. This can be achieved by modifying the name.replace method to include backslashes in the regular expression. We will use a regular expression with the g flag to ensure that all occurrences of special characters, including backslashes, are replaced.

Suggested changeset 1
src/utils/dataConvert.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/utils/dataConvert.js b/src/utils/dataConvert.js
--- a/src/utils/dataConvert.js
+++ b/src/utils/dataConvert.js
@@ -76,3 +76,3 @@
         if (!url) url = window.location.href;
-        name = name.replace(/[\[\]]/g, '\\$&');
+        name = name.replace(/([[\]\\])/g, '\\$&');
         var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
EOF
@@ -76,3 +76,3 @@
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
name = name.replace(/([[\]\\])/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant