sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
523 stars 75 forks source link

Paths with a double slash are not handled properly #115

Open hugoShaka opened 2 years ago

hugoShaka commented 2 years ago

Describe the bug

context I try to access http://hostname:port//index.html

expectation I expected the webserver to return the content of index.html

bug But instead it tries to access a file named /index.html and returns a HTTP 403.

[W 220503 15:28:56 web:1787] 403 GET //index.html (172.17.0.1): /index.html is not in root static directory
[W 220503 15:28:56 web:2239] 403 GET //index.html (172.17.0.1) 0.86ms

problem This is a problem for people using sphinx themes in which some js resource path have two slashes. See https://github.com/jbms/sphinx-immaterial/issues/94

Reproduce the bug

  1. Serve any sphinx doc with sphinx-autobuild
  2. Access http://localhost:port/index.html (should work)
  3. Access http://localhost:port//index.html (should not work)

List your environment

No response

welcome[bot] commented 2 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: