Skip to content

Commit

Permalink
Fix bug redirection by parsing properly path and search.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimmi48 committed Oct 12, 2023
1 parent 6fdb10b commit ddae0b9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pages/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
const refmanRegex = /^\/distrib\/(.*)\/refman\//;
const V80refmanRegex = /^\/distrib\/V8.0\/doc\//;
const stdlibDistribRegex = /^\/distrib\/(.*)\/stdlib\//;
const bugRegexSimplified = /^\/bug\/(.*)/;
const bugRegex = /^\/bugs\/show_bug\.cgi\?id=(.*)/;
const bugSimplifiedRegex = /^\/bug\/(.*)/;
const bugPath = "/bugs/show_bug.cgi"
const bugSearchRegex = /^\?id=(.*)/;
if (stdlibRegex.test(path)) {
window.location = path.replace(stdlibRegex, "/doc/<#CURRENTVERSIONTAG>/stdlib/");
} else if (refmanRegex.test(path)) {
Expand All @@ -27,12 +28,12 @@
}
} else if (V80refmanRegex.test(path)) {
window.location = path.replace(V80refmanRegex, "/doc/V8.0/doc/");
} else if (bugRegexSimplified.test(path)) {
const bugId = path.match(bugRegexSimplified)[1];
} else if (bugSimplifiedRegex.test(path)) {
const bugId = path.match(bugSimplifiedRegex)[1];
// To avoid having to rely on the correspondence table from the migration, we redirect to the search page
window.location = "https://github.com/coq/coq/issues?q=is%3Aissue%20%22Original%20bug%20ID%3A%20BZ%23" + bugId + "%22"
} else if (bugRegex.test(path)) {
const bugId = path.match(bugRegex)[1];
} else if (bugPath == path && bugSearchRegex.test(window.location.search)) {
const bugId = window.location.search.match(bugSearchRegex)[1];
window.location = "https://github.com/coq/coq/issues?q=is%3Aissue%20%22Original%20bug%20ID%3A%20BZ%23" + bugId + "%22"
} else {
document.write("<h1>Not found</h1>");
Expand Down

0 comments on commit ddae0b9

Please sign in to comment.