Allow "gemini://example.com" to resolve without a trailing slash
This commit is contained in:
parent
887343de3c
commit
4ba3cc6c23
|
@ -5,6 +5,9 @@
|
||||||
#### Spec Changes
|
#### Spec Changes
|
||||||
|
|
||||||
- Requests containing URLs without a scheme are no longer accepted.
|
- 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)
|
### v0.6.0 (2020-07-30)
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class StaticDirectoryApplication(JetforceApplication):
|
||||||
return Response(Status.SUCCESS, mimetype, generator)
|
return Response(Status.SUCCESS, mimetype, generator)
|
||||||
|
|
||||||
elif filesystem_path.is_dir():
|
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)
|
url_parts = urllib.parse.urlparse(request.url)
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
url_parts = url_parts._replace(path=request.path + "/")
|
url_parts = url_parts._replace(path=request.path + "/")
|
||||||
|
|
Loading…
Reference in New Issue