File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1392,8 +1392,12 @@ impl Url {
1392
1392
}
1393
1393
parser. parse_cannot_be_a_base_path ( parser:: Input :: new ( path) ) ;
1394
1394
} else {
1395
+ let path_start = parser. serialization . len ( ) ;
1395
1396
let mut has_host = true ; // FIXME
1396
1397
parser. parse_path_start ( scheme_type, & mut has_host, parser:: Input :: new ( path) ) ;
1398
+ if scheme_type. is_file ( ) {
1399
+ parser:: trim_path ( & mut parser. serialization , path_start) ;
1400
+ }
1397
1401
}
1398
1402
} ) ;
1399
1403
self . restore_after_path ( old_after_path_pos, & after_path) ;
Original file line number Diff line number Diff line change @@ -1443,12 +1443,14 @@ impl<'a> Parser<'a> {
1443
1443
1444
1444
// Trim path start forward slashes when no authority is present
1445
1445
// https://github.com/whatwg/url/issues/232
1446
- fn trim_path ( serialization : & mut String , path_start : usize ) {
1446
+ pub fn trim_path ( serialization : & mut String , path_start : usize ) {
1447
1447
let path = serialization. split_off ( path_start) ;
1448
1448
if path. starts_with ( "/" ) {
1449
1449
let mut trimmed_path = "/" . to_string ( ) ;
1450
1450
trimmed_path. push_str ( path. trim_start_matches ( "/" ) ) ;
1451
1451
serialization. push_str ( & trimmed_path) ;
1452
+ } else {
1453
+ serialization. push_str ( & path) ;
1452
1454
}
1453
1455
}
1454
1456
You can’t perform that action at this time.
0 commit comments