From 4ba3cc6c2315e5f3566ec1b9bd9437b8f6424a06 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Sun, 29 Nov 2020 22:30:47 -0500 Subject: [PATCH] Allow "gemini://example.com" to resolve without a trailing slash --- CHANGELOG.md | 3 +++ jetforce/app/static.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47908c4..ac512bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/jetforce/app/static.py b/jetforce/app/static.py index 991e171..dbb6cbe 100644 --- a/jetforce/app/static.py +++ b/jetforce/app/static.py @@ -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 + "/")