File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1336,8 +1336,12 @@ impl Url {
1336
1336
}
1337
1337
parser. parse_cannot_be_a_base_path ( parser:: Input :: new ( path) ) ;
1338
1338
} else {
1339
+ let path_start = parser. serialization . len ( ) ;
1339
1340
let mut has_host = true ; // FIXME
1340
1341
parser. parse_path_start ( scheme_type, & mut has_host, parser:: Input :: new ( path) ) ;
1342
+ if scheme_type. is_file ( ) {
1343
+ parser:: trim_path ( & mut parser. serialization , path_start) ;
1344
+ }
1341
1345
}
1342
1346
} ) ;
1343
1347
self . restore_after_path ( old_after_path_pos, & after_path) ;
Original file line number Diff line number Diff line change @@ -1425,12 +1425,14 @@ impl<'a> Parser<'a> {
1425
1425
1426
1426
// Trim path start forward slashes when no authority is present
1427
1427
// https://github.com/whatwg/url/issues/232
1428
- fn trim_path ( serialization : & mut String , path_start : usize ) {
1428
+ pub fn trim_path ( serialization : & mut String , path_start : usize ) {
1429
1429
let path = serialization. split_off ( path_start) ;
1430
1430
if path. starts_with ( "/" ) {
1431
1431
let mut trimmed_path = "/" . to_string ( ) ;
1432
1432
trimmed_path. push_str ( path. trim_start_matches ( "/" ) ) ;
1433
1433
serialization. push_str ( & trimmed_path) ;
1434
+ } else {
1435
+ serialization. push_str ( & path) ;
1434
1436
}
1435
1437
}
1436
1438
You can’t perform that action at this time.
0 commit comments