Skip to content

Try to serve index.html if link points to directory #288

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

Closed
almielczarek opened this issue Jan 19, 2019 · 3 comments · Fixed by #584
Closed

Try to serve index.html if link points to directory #288

almielczarek opened this issue Jan 19, 2019 · 3 comments · Fixed by #584
Labels
E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started

Comments

@almielczarek
Copy link

This change may fix a lot of broken links such as the ones I've found in hyperium/hyper#1749 and hyperium/hyper#1750

@almielczarek
Copy link
Author

almielczarek commented Jan 19, 2019

I peeked at web::rustdoc::rustdoc_html_server_handler and it looks like it checks if a file exists at the request path and if it doesn't it immediately returns a 404.

Perhaps we could try pushing "index.html" to the end of the path once in the None branch of this match block and check if that new path exists before returning a 404.

@jyn514 jyn514 added E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started labels Feb 1, 2020
@jyn514
Copy link
Member

jyn514 commented Feb 1, 2020

We currently add index.html for /, but not if the slash is missing. Thanks for writing up instructions!

@d-e-s-o
Copy link

d-e-s-o commented Feb 1, 2020

Just hit the same issue with tokio docs. Wanted to see documentation for the https://docs.rs/tokio/0.2.11/tokio/time but "the resource does not exist". Adding slash or /index.html works, but if you don't know that you are basically forced to try to navigate from the project's documentation root to find what you need, which is rather tedious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Effort: Should be easy to implement and would make a good first PR mentor This has instructions for getting started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants