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

Trailing "/" (slashes) at the end of URL brings out the error 404, not found page #2432

Open
riojosdev opened this issue Aug 26, 2024 · 1 comment
Assignees
Labels
C-bug Category: A bug, incorrect or unintended behavior

Comments

@riojosdev
Copy link

riojosdev commented Aug 26, 2024

Problem

Trailing slashes "/" at the end of the URL, even if the file extension is an ".html" file, the renderer calls the 404 page. This might be done following the RFC 1738. Which represents with slashes at the end as a directory like "example.com/directory/" & without slashes representing a file like so "example.com/file.ext"

The following information was found regarding this:

https://developers.google.com/search/blog/2010/04/to-slash-or-not-to-slash

https://stackoverflow.com/questions/5948659/when-should-i-use-a-trailing-slash-in-my-url

https://datatracker.ietf.org/doc/rfc1738/

Steps

  1. Add a trailing single forward slash / at the end of url ending with .html

Possible Solution(s)

The renderer should check whether the not found error is caused by an "allowed character", here in this case is a forward slash /. And if yes, then recheck if file exists by removing the "allowed character".

Notes

Using a list of "allowed character" to bypass certain http status codes, is a debatable topic. Will this feature be misused? Certain special characters could cause a different functionality to be executed by the browsers.

Version

mdbook v0.4.40
@riojosdev riojosdev added the C-bug Category: A bug, incorrect or unintended behavior label Aug 26, 2024
@riojosdev
Copy link
Author

@rustbot claim

@rust-lang rust-lang deleted a comment from riojosdev Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: A bug, incorrect or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants
@riojosdev and others