summaryrefslogtreecommitdiffstats
path: root/src/tools/error_index_generator/redirect.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/tools/error_index_generator/redirect.js
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/error_index_generator/redirect.js')
-rw-r--r--src/tools/error_index_generator/redirect.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/tools/error_index_generator/redirect.js b/src/tools/error_index_generator/redirect.js
index 8c907f579..c80cbf297 100644
--- a/src/tools/error_index_generator/redirect.js
+++ b/src/tools/error_index_generator/redirect.js
@@ -3,14 +3,10 @@
let code = window.location.hash.replace(/^#/, '');
// We have to make sure this pattern matches to avoid inadvertently creating an
// open redirect.
- if (!/^E[0-9]+$/.test(code)) {
+ if (/^E[0-9]+$/.test(code)) {
+ window.location.replace('./error_codes/' + code + '.html');
return;
}
- if (window.location.pathname.indexOf("/error_codes/") !== -1) {
- // We're not at the top level, so we don't prepend with "./error_codes/".
- window.location = './' + code + '.html';
- } else {
- window.location = './error_codes/' + code + '.html';
- }
}
+ window.location.replace('./error_codes/error-index.html');
})()