Skip to content
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

All /browse routes require a trailing slash #219

Open
Friss opened this issue Sep 30, 2019 · 5 comments · May be fixed by #225
Open

All /browse routes require a trailing slash #219

Friss opened this issue Sep 30, 2019 · 5 comments · May be fixed by #225
Labels

Comments

@Friss
Copy link

Friss commented Sep 30, 2019

I was trying to look at a package by modifying the URL and I kept getting a 404 page until I discovered I needed the trailing slash to work.

Example:

Doesn't work:
https://unpkg.com/browse/[email protected]

Works:
https://unpkg.com/browse/[email protected]/

Same thing for sub directories

Doesn't work:
https://unpkg.com/browse/[email protected]/es

Works:
https://unpkg.com/browse/[email protected]/es/

@mjackson
Copy link
Owner

mjackson commented Oct 1, 2019

Ya, thanks for bringing this up. I noticed the same thing a while back. It's a bug I introduced when I built the browse API. Need to fix.

@mjackson mjackson added the bug label Oct 1, 2019
@kevin940726
Copy link

@mjackson I would like to help with this. Appreciate any heads up for where I should be paying attention to.

@mjackson
Copy link
Owner

mjackson commented Oct 7, 2019

It'll probably be something around here. At the /browse path prefix, I don't think we need to do strict routing like we do at the URL root /. I think we should just serve the HTML page without the trailing slash (e.g. /browse/[email protected]) and redirect a trailing / to the version w/out the trailing slash.

@mjackson
Copy link
Owner

mjackson commented Oct 7, 2019

BTW when this is fixed we should probably also update this code to redirect to the version of the URL w/out the trailing slash, to prevent a double redirect.

@mjackson mjackson changed the title All routes require a trailing slash All /browse routes require a trailing slash Oct 7, 2019
@kevin940726 kevin940726 linked a pull request Oct 8, 2019 that will close this issue
@MichaelDeBoey
Copy link

I came across this bug when wanting to go to https://unpkg.com/browse/@testing-library/react, but I saw @kevin940726 already created #225 to fix it 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants