Fix error-index redirect to work with the back button.#106491
Fix error-index redirect to work with the back button.#106491bors merged 2 commits intorust-lang:masterfrom
Conversation
|
(rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Please preserve this comment. It's important that the official rust-lang.org website, which people visit to download the compiler, not host any open redirects.
There was a problem hiding this comment.
Oh, good point, thanks!
63575d9 to
368c058
Compare
There was a problem hiding this comment.
Why not making this change in the JS file directly? It had the advantage of keeping things split (JS split from HTML) which is easier to read/maintain.
There was a problem hiding this comment.
Oh, no particular reason. It was no longer being shared between different pages, and it seemed a little more convenient to have everything in one place. I don't have a strong preference, though, so I pushed an update to keep it in the old location.
There was a problem hiding this comment.
Thanks! It also makes the changes much smaller. :)
368c058 to
72c3082
Compare
|
Looks good to me. Thanks for the improvement! |
|
r? notriddle @bors r=GuillaumeGomez,notriddle rollup |
Rollup of 5 pull requests Successful merges: - rust-lang#106400 (Point at expressions where inference refines an unexpected type) - rust-lang#106491 (Fix error-index redirect to work with the back button.) - rust-lang#106494 (Add regression test for rust-lang#58355) - rust-lang#106499 (fix [type error] for error E0029 and E0277) - rust-lang#106502 (rustdoc: remove legacy user-select CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This fixes the redirect page at https://doc.rust-lang.org/error-index.html so that it works with the browser's back-button. The solution is to use
window.location.replace(), which avoids adding the page to the browser history stack.This also cleans up the code a little bit, since it looks like it was written with different assumptions (maybe before f5857d5). I don't think there is a need to have a redirect at https://doc.rust-lang.org/error_codes/error-index.html since I don't think fragment-based links were ever used there.
I have tested with Firefox, Chrome, and Safari. Going to
/error-index.htmlredirects without adding to the stack, and can use the back button. Additionally,/error-index.html#E0005redirects correctly to the error page.Finally, there is an unrelated commit to remove the 404 hack. There is an official way of avoiding the generation of the 404 page with setting input-404 to an empty value.
Fixes #106485