Allow "gemini://example.com" to resolve without a trailing slash

This commit is contained in:
Michael Lazar 2020-11-29 22:30:47 -05:00
parent 887343de3c
commit 4ba3cc6c23
2 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,9 @@
#### Spec Changes
- Requests containing URLs without a scheme are no longer accepted.
- The server will stop redirecting the root URL "gemini://example.com" to
"gemini://example.com/". These URLs are cannonically the same per the url RFC
definition and should both return successful responses.
### v0.6.0 (2020-07-30)

View File

@ -124,7 +124,7 @@ class StaticDirectoryApplication(JetforceApplication):
return Response(Status.SUCCESS, mimetype, generator)
elif filesystem_path.is_dir():
if not request.path.endswith("/"):
if request.path and not request.path.endswith("/"):
url_parts = urllib.parse.urlparse(request.url)
# noinspection PyProtectedMember
url_parts = url_parts._replace(path=request.path + "/")