From 2ff14448863ac1a1dd9533461708e29aae170c2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:31 +0200 Subject: Adding debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- src/tools/error_index_generator/redirect.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/tools/error_index_generator/redirect.js (limited to 'src/tools/error_index_generator/redirect.js') diff --git a/src/tools/error_index_generator/redirect.js b/src/tools/error_index_generator/redirect.js new file mode 100644 index 000000000..8c907f579 --- /dev/null +++ b/src/tools/error_index_generator/redirect.js @@ -0,0 +1,16 @@ +(function() { + if (window.location.hash) { + 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)) { + 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'; + } + } +})() -- cgit v1.2.3