summaryrefslogtreecommitdiffstats
path: root/src/tools/error_index_generator/redirect.js
blob: c80cbf297afffeab665939ebfd2491e21ceace1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
(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)) {
            window.location.replace('./error_codes/' + code + '.html');
            return;
        }
    }
    window.location.replace('./error_codes/error-index.html');
})()