@@ -85,7 +85,7 @@ async fn handle_request(
85
85
return Ok ( not_found ( ) ) ;
86
86
}
87
87
88
- let trimmed_path = & path_str[ base_path. len ( ) ..] ;
88
+ let trimmed_path = & path_str[ base_path. len ( ) - 1 ..] ;
89
89
90
90
let original_root = root. clone ( ) ;
91
91
let mut path = RelativePathBuf :: new ( ) ;
@@ -284,7 +284,11 @@ fn construct_url(base_url: &str, no_port_append: bool, interface_port: u16) -> S
284
284
format ! ( "{}{}:{}{}" , protocol, domain, interface_port, path)
285
285
} ;
286
286
287
- full_address
287
+ if full_address. ends_with ( '/' ) {
288
+ full_address
289
+ } else {
290
+ format ! ( "{}/" , full_address)
291
+ }
288
292
}
289
293
290
294
#[ allow( clippy:: too_many_arguments) ]
@@ -857,25 +861,25 @@ mod tests {
857
861
#[ test]
858
862
fn test_construct_url_http_protocol ( ) {
859
863
let result = construct_url ( "http://example.com" , false , 8080 ) ;
860
- assert_eq ! ( result, "http://example.com:8080" ) ;
864
+ assert_eq ! ( result, "http://example.com:8080/ " ) ;
861
865
}
862
866
863
867
#[ test]
864
868
fn test_construct_url_https_protocol ( ) {
865
869
let result = construct_url ( "https://example.com" , false , 8080 ) ;
866
- assert_eq ! ( result, "https://example.com:8080" ) ;
870
+ assert_eq ! ( result, "https://example.com:8080/ " ) ;
867
871
}
868
872
869
873
#[ test]
870
874
fn test_construct_url_no_protocol ( ) {
871
875
let result = construct_url ( "example.com" , false , 8080 ) ;
872
- assert_eq ! ( result, "http://example.com:8080" ) ;
876
+ assert_eq ! ( result, "http://example.com:8080/ " ) ;
873
877
}
874
878
875
879
#[ test]
876
880
fn test_construct_url_no_port_append ( ) {
877
881
let result = construct_url ( "https://example.com" , true , 8080 ) ;
878
- assert_eq ! ( result, "https://example.com" ) ;
882
+ assert_eq ! ( result, "https://example.com/ " ) ;
879
883
}
880
884
881
885
#[ test]
0 commit comments