Skip to content

frontend: Redirect when space in crate name #11580

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 1 commit into
base: main
Choose a base branch
from

Conversation

Its-Just-Nans
Copy link

Hi

When there is leading or trailing space in the crate name, the crate is not found (obviously)

https://crates.io/crates/syn Working

https://crates.io/crates/%20syn Not found

I think this could be useful, mostly if we paste a crate name

@Turbo87
Copy link
Member

Turbo87 commented Jul 16, 2025

@rust-lang/crates-io any thoughts?

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-frontend 🐹 labels Jul 16, 2025
@Turbo87 Turbo87 changed the title feature: redirect when space in crate name frontend: Redirect when space in crate name Jul 16, 2025
@LawnGnome
Copy link
Contributor

I'm assuming the use case here is something like a keyword bookmark https://crates.io/crates/%s.

I can see why it would be useful (since I use keywords all the time), but I'm not sure it makes sense to complicate the frontend route handling to support this, since the search does ignore leading or trailing whitespace correctly. I'm probably -0.5 on changing this, but I also don't feel very strongly.

@Its-Just-Nans
Copy link
Author

On my side it was more a UX improvement

If I go to https://crates.io/crates/syn

image

But If I make a small typo (and a bad copy-paste) and go here

https://crates.io/crates/%20syn

image

The message "syn: Crate not found" is not great

image

So either

  • change to have a redirection
  • add quote to the message
image image

Both fixes are easy and seems OK
But I prefer the redirection since there is a lot probability that the user modify his typo

@eth3lbert
Copy link
Contributor

I'm okay with it. It doesn't overcomplicate things and brings some improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants