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>r0.7
parent
86a8612750
commit
34842141e4
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue