@@ -586,10 +586,6 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
586
586
return Some ( not_found ( ) ) ;
587
587
}
588
588
589
- if !Path :: new ( & fs_path) . is_file ( ) {
590
- return None ;
591
- }
592
-
593
589
let etag = ETag :: from_str ( & * format ! ( r#""{}""# , * VERSION_UUID ) ) . unwrap ( ) ;
594
590
let mut response = http:: Response :: builder ( )
595
591
. header_typed ( etag. clone ( ) )
@@ -602,6 +598,20 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
602
598
}
603
599
}
604
600
601
+ let source = match path {
602
+ "/bootstrap.html" | "/help.html" | "/status.html" => TEMPLATES
603
+ . render ( & format ! ( "pages/{}" , path. trim_start_matches( "/" ) ) )
604
+ . await
605
+ . unwrap ( )
606
+ . into_bytes ( ) ,
607
+ _ => {
608
+ if !Path :: new ( & fs_path) . is_file ( ) {
609
+ return None ;
610
+ }
611
+ fs:: read ( & fs_path) . unwrap ( )
612
+ }
613
+ } ;
614
+
605
615
let p = Path :: new ( & fs_path) ;
606
616
match p. extension ( ) . and_then ( |x| x. to_str ( ) ) {
607
617
Some ( "html" ) => response = response. header_typed ( ContentType :: html ( ) ) ,
@@ -613,11 +623,6 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
613
623
_ => ( ) ,
614
624
}
615
625
616
- let source = match path {
617
- "/help.html" => TEMPLATES . render ( "help.html" ) . await . unwrap ( ) . into_bytes ( ) ,
618
- _ => fs:: read ( & fs_path) . unwrap ( ) ,
619
- } ;
620
-
621
626
Some ( response. body ( hyper:: Body :: from ( source) ) . unwrap ( ) )
622
627
}
623
628
0 commit comments