From cc70537a917702371e666b465dabda700dfa4693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 28 Sep 2023 11:09:31 +0200 Subject: [PATCH] webui: pretty urls by also appending .html --- pkgs/clan-cli/clan_cli/webui/routers/root.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/webui/routers/root.py b/pkgs/clan-cli/clan_cli/webui/routers/root.py index 059950603..e8121d07c 100644 --- a/pkgs/clan-cli/clan_cli/webui/routers/root.py +++ b/pkgs/clan-cli/clan_cli/webui/routers/root.py @@ -20,9 +20,10 @@ async def root(path_name: str) -> Response: return Response(status_code=403) if not filename.is_file(): - print(filename) - print(asset_path()) - return Response(status_code=404) + if filename.suffix == "": + filename = filename.with_suffix(".html") + if not filename.is_file(): + return Response(status_code=404) content_type, _ = guess_type(filename) return Response(filename.read_bytes(), media_type=content_type)