diff --git a/pages/404.html b/pages/404.html index 8e9f51e568..bb1d22f77e 100644 --- a/pages/404.html +++ b/pages/404.html @@ -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)) { @@ -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("