#5 Permenant redirect for root URL if missing slash

This commit is contained in:
Michael Lazar 2020-01-12 14:00:42 -05:00
parent e788e31dac
commit 6c414ca9d4
1 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,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 request.path and not request.path.endswith("/"): if not request.path.endswith("/"):
url_parts = urllib.parse.urlparse(request.url) url_parts = urllib.parse.urlparse(request.url)
url_parts = url_parts._replace(path=request.path + "/") url_parts = url_parts._replace(path=request.path + "/")
return Response(Status.REDIRECT_PERMANENT, url_parts.geturl()) return Response(Status.REDIRECT_PERMANENT, url_parts.geturl())
@ -346,7 +346,7 @@ class GeminiRequestHandler:
writer: asyncio.StreamWriter writer: asyncio.StreamWriter
received_timestamp: time.struct_time received_timestamp: time.struct_time
remote_addr: str remote_addr: str
client_crt: dict client_cert: dict
url: str url: str
status: int status: int
meta: str meta: str