Skip to content

Commit 1b10b5a

Browse files
fix: redirection issue with regex (#67)
* fix: redirection issue with regex * Apply suggestion from @johanneskoester --------- Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
1 parent 6dfabd7 commit 1b10b5a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

source/_static/redirect.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
document.addEventListener("DOMContentLoaded", function () {
22
const params = new URLSearchParams(window.location.search);
33
let workflow = params.get("wf") ?? params.get("usage");
4-
54
if (workflow) {
65
// Allow only expected slug characters.
7-
if (!/^[A-Za-z0-9_-\/]+$/.test(workflow)) {
8-
console.error(`Invalid workflow specification (allowed is [A-Za-z0-9_-\/]+): ${workflow}`);
9-
return;
6+
if (!/^[A-Za-z0-9\/_-]+$/.test(workflow)) {
7+
console.error(
8+
`Invalid workflow specification (allowed is ^[A-Za-z0-9\/_-]+$): ${workflow}`,
9+
);
10+
return;
1011
}
1112
// Dynamically construct the target URL
1213
const targetUrl = `docs/workflows/${workflow}.html`;

0 commit comments

Comments
 (0)