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 {
13921392 }
13931393 parser. parse_cannot_be_a_base_path ( parser:: Input :: new ( path) ) ;
13941394 } else {
1395+ let path_start = parser. serialization . len ( ) ;
13951396 let mut has_host = true ; // FIXME
13961397 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+ }
13971401 }
13981402 } ) ;
13991403 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> {
14431443
14441444// Trim path start forward slashes when no authority is present
14451445// 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 ) {
14471447 let path = serialization. split_off ( path_start) ;
14481448 if path. starts_with ( "/" ) {
14491449 let mut trimmed_path = "/" . to_string ( ) ;
14501450 trimmed_path. push_str ( path. trim_start_matches ( "/" ) ) ;
14511451 serialization. push_str ( & trimmed_path) ;
1452+ } else {
1453+ serialization. push_str ( & path) ;
14521454 }
14531455}
14541456
You can’t perform that action at this time.
0 commit comments