forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move error code book into a sub folder
- Loading branch information
1 parent
1171697
commit f5857d5
Showing
2 changed files
with
40 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
(function() {{ | ||
if (window.location.hash) {{ | ||
(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)) {{ | ||
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'; | ||
}} | ||
}} | ||
}})() | ||
} | ||
} | ||
})() |