Skip to content

Retain queries and convert :: paths on redirects to rust-lang.org #1816

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

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Sep 1, 2022

fixes #751, but using :: separated paths instead of the / ones mentioned in the issue.

@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Sep 1, 2022
Copy link
Member

@syphar syphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code looks good
  • tests look good

Since the coverage on redirects is relatively good I'm also certain that nothing breaks :)

Only edge-case I can think of is that if I add any query arg to this endpoint, the query won't be added: https://docs.rs/std::path?some=arg -> https://doc.rust-lang.org/stable/std/?some=arg. But IMO this doesn't matter

Manual test also works.

@@ -155,6 +134,12 @@ pub fn rustdoc_redirector_handler(req: &mut Request) -> IronResult<Response> {
Some((krate, path)) => (krate.to_string(), Some(path.to_string())),
None => (crate_name.to_string(), None),
};

if let Some(inner_path) = DOC_RUST_LANG_ORG_REDIRECTS.get(crate_name.as_str()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels strange to put this into the rustdoc-handler, in theory we could refactor the shared behaviour into separate methods and then have separate handlers.

But since axum forbids overlapping routes contrary to iron which just takes the first matching route, we would have to merge the handlers anyways to a certain extend.

So this is OK with me.

@Nemo157 Nemo157 merged commit 3d2d3cb into rust-lang:master Sep 9, 2022
@Nemo157 Nemo157 deleted the std-queries branch September 9, 2022 06:44
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 9, 2022
@syphar syphar removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs.rs/std/<path>?<args> should redirect path and args to doc.rust-lang
2 participants