Skip to content

Keep arguments in redirections #2800

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

GuillaumeGomez
Copy link
Member

Fixes #2786.

I created a new type to ensure that the escaping was done only once.

@GuillaumeGomez GuillaumeGomez requested a review from a team as a code owner April 11, 2025 18:33
@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Apr 11, 2025
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.

we probably also should update the rustdoc_redirector_handler to forward the query args.

Also we should see if the trailing-slash-redirect we're using also forwards the query (not sure if we should spend time on fixing it if it doesn't).

@GuillaumeGomez
Copy link
Member Author

Only using the query now.

@syphar
Copy link
Member

syphar commented Apr 14, 2025

we probably also should update the rustdoc_redirector_handler to forward the query args.

did you intentionally leave out the redirector handler?

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Apr 14, 2025

There was only one case which needed it as most of them are already using redirect_to_doc which adds redirections. Anyway, I think all of them are covered now.

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.

Nearly there, thank you for working on this!

format!("/crate/{crate_name}/{}", matched_release.req_version),
EscapedURI::new(
&format!("/crate/{crate_name}/{}", matched_release.req_version),
uri.query(),
Copy link
Member

Choose a reason for hiding this comment

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

I'm missing a test for this updated behaviour here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't figure out what's the URL for it. I tried /crate/sysinfo/0.29.0?search=q and /crate/sysinfo/0.40.0?search=q and both have the query arguments even before this change. Any idea?

Copy link
Member

Choose a reason for hiding this comment

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

the redirector is behind URLs like /sysinfo

Copy link
Member

Choose a reason for hiding this comment

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

ah wait, you're searching for an example for this specific else part

Copy link
Member

Choose a reason for hiding this comment

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

you will only reach it when rustdoc_status is false.

That being said, should we update the query_pairs in the redirect_to_doc function in here too to your new EscapedURI?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure it's worth it considering we need to overload the search query if it exists and then we make use of axum_parse_uri_with_params.

Copy link
Member Author

Choose a reason for hiding this comment

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

you will only reach it when rustdoc_status is false.

Can't find a way to write a test with this case. Do we have a test with this situation by any chance?

@syphar
Copy link
Member

syphar commented Apr 19, 2025

generally: with all the github noise I typically work with the personal "review requests" tab quite much, and check these more often than notifications in general, so re-requesting a review when it's ready again really helps me.

( I'll see the other notifications later too, but not as fast)

@GuillaumeGomez
Copy link
Member Author

generally: with all the github noise I typically work with the personal "review requests" tab quite much, and check these more often than notifications in general, so re-requesting a review when it's ready again really helps me.

( I'll see the other notifications later too, but not as fast)

Noted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs.rs removes query parameters on redirect
2 participants