Skip to content

Commit 91a0575

Browse files
authored
Sanitize URL on navigation change
Escape special characters in the URL before redirection. Hopefully this works. This was according to Copilot by Microsoft.
1 parent 64153b5 commit 91a0575

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

static/nav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function addANav() {
4848

4949
sel.addEventListener("change", () => {
5050
if (sel.value !== current && acceptablePaths.includes(window.location.pathname)) {
51-
window.location.href = sel.value;
51+
window.location.href = sel.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
5252
}
5353
});
5454

0 commit comments

Comments
 (0)