-
Notifications
You must be signed in to change notification settings - Fork 212
Fix "go to latest version" for /src/ when an item was renamed #1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
let mut updated = ["src", &package.name, src].join("/"); | ||
updated += ".html"; | ||
let source_html = format!( | ||
"<html><head></head><body>{}</body></html>", | ||
std::str::from_utf8(data).expect("invalid utf8") | ||
); | ||
rustdoc_files.push(( | ||
Box::leak(Box::new(updated)), | ||
Box::leak(source_html.into_bytes().into_boxed_slice()), | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took me so long to debug - the HTML rewriter doesn't actually do anything unless at least these tags exist.
src/test/fakes.rs
Outdated
if path.starts_with("/") { | ||
failure::bail!("absolute paths not supported"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also took ages to debug.
ca2ce2f
to
cc080d3
Compare
@syphar do you have time to review this? |
@jyn514 I will check it out, probably this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I went through it, as far as I know the code.
In general I remember that especially all this redirecting was touched to often that it's actually covered with tests quite well. (please correct me if I'm wrong).
Apart from my wish for an explaining comment, there is only one thing that I found in manual testing:
When the old version's URL had a line-number attached (with #100
for example), it would also end up in the search-URL. Since it does not end up in the search-field, we could just leave it.
Yes, redirects are tested quite well (I think they may have been the first thing we added tests for).
Hmm, I don't mind keeping it (working on that now), but it shouldn't make a difference one way or another like you said. |
I just realized this is a pre-existing bug - I'd like to leave it for a follow up. Feel free to open an issue for it :) |
Fixes #513.