-
-
Notifications
You must be signed in to change notification settings - Fork 1
Fix strikes page JavaScript errors #70
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
Conversation
Fixed issues with the strikes page (my-strikes.html): 1. Corrected HTML structure with properly closed tags 2. Fixed JavaScript errors in parameter handling 3. Moved jQuery script to proper location 4. Fixed incorrect content references in dynamic section logic 5. Improved code formatting and fixed typos Closes # 69
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello and welcome to Coding Hut! It looks like this is your first pull request that you made.
@@ -107,6 +108,7 @@ | |||
} | |||
} | |||
</style> | |||
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script> |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source Medium
// Parse the URL parameter | ||
function getParameterByName(name, url) { | ||
if (!url) url = window.location.href; | ||
name = name.replace(/[\[\]]/g, "\\$&"); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the issue, we need to ensure that backslashes in the name
parameter are properly escaped before constructing the regular expression. This can be achieved by adding an additional replace
call to escape backslashes (\
) in the input string. Specifically:
- Add a
replace
call to escape backslashes before escaping square brackets. - Use a well-tested approach to escape backslashes by replacing each backslash with a double backslash (
\\
).
The updated code will ensure that both backslashes and square brackets are properly escaped, making the function robust against malformed or insecure regular expressions.
-
Copy modified line R175
@@ -174,3 +174,3 @@ | ||
if (!url) url = window.location.href; | ||
name = name.replace(/[\[\]]/g, "\\$&"); | ||
name = name.replace(/\\/g, "\\\\").replace(/[\[\]]/g, "\\$&"); | ||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
Thank you for reviewing and merging these changes! The fixes should resolve the JavaScript errors and address the security issues that were identified during code scanning. The strikes page should now properly:
Let me know if you encounter any other issues with the page. |
Fixed issues with the strikes page (my-strikes.html):
Closes #69
🤖 See my steps and cost here ✨