From 34842141e47d3da121ab3b23a200168249221b9d Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Sun, 10 Dec 2023 23:58:21 +0800 Subject: [PATCH] fix: for html paths, .html suffix should be appended automatically (#1015) * fix: for html paths, .html suffix should be appended automatically * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- ee/tabby-webserver/src/ui.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ee/tabby-webserver/src/ui.rs b/ee/tabby-webserver/src/ui.rs index 50d80df..4c462cb 100644 --- a/ee/tabby-webserver/src/ui.rs +++ b/ee/tabby-webserver/src/ui.rs @@ -37,10 +37,8 @@ pub async fn handler(uri: Uri) -> impl IntoResponse { let mut path = uri.path().trim_start_matches('/').to_string(); if path.is_empty() { path = "index.html".to_owned() - } else if path == "playground" { - path = "playground.html".to_owned(); - } else if path == "swagger" { - path = "swagger.html".to_owned(); + } else if !path.contains('.') && WebAssets::get(&format!("{}.html", path)).is_some() { + path += ".html" } WebStaticFile(path) }