File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -798,8 +798,24 @@ impl<'a> Parser<'a> {
798
798
self . serialization . push_str ( before_query) ;
799
799
// FIXME spec says just "remove last entry", not the "pop" algorithm
800
800
self . pop_path ( scheme_type, base_url. path_start as usize ) ;
801
- let remaining =
802
- self . parse_path ( scheme_type, & mut true , base_url. path_start as usize , input) ;
801
+ // A special url always has a path.
802
+ // A path always starts with '/'
803
+ if self . serialization . len ( ) == base_url. path_start as usize {
804
+ if SchemeType :: from ( base_url. scheme ( ) ) . is_special ( ) || !input. is_empty ( ) {
805
+ self . serialization . push ( '/' ) ;
806
+ }
807
+ }
808
+ let remaining = match input. split_first ( ) {
809
+ ( Some ( '/' ) , remaining) => self . parse_path (
810
+ scheme_type,
811
+ & mut true ,
812
+ base_url. path_start as usize ,
813
+ remaining,
814
+ ) ,
815
+ _ => {
816
+ self . parse_path ( scheme_type, & mut true , base_url. path_start as usize , input)
817
+ }
818
+ } ;
803
819
self . with_query_and_fragment (
804
820
scheme_type,
805
821
base_url. scheme_end ,
You can’t perform that action at this time.
0 commit comments