File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -780,8 +780,24 @@ impl<'a> Parser<'a> {
780
780
self . serialization . push_str ( before_query) ;
781
781
// FIXME spec says just "remove last entry", not the "pop" algorithm
782
782
self . pop_path ( scheme_type, base_url. path_start as usize ) ;
783
- let remaining =
784
- self . parse_path ( scheme_type, & mut true , base_url. path_start as usize , input) ;
783
+ // A special url always has a path.
784
+ // A path always starts with '/'
785
+ if self . serialization . len ( ) == base_url. path_start as usize {
786
+ if SchemeType :: from ( base_url. scheme ( ) ) . is_special ( ) || !input. is_empty ( ) {
787
+ self . serialization . push ( '/' ) ;
788
+ }
789
+ }
790
+ let remaining = match input. split_first ( ) {
791
+ ( Some ( '/' ) , remaining) => self . parse_path (
792
+ scheme_type,
793
+ & mut true ,
794
+ base_url. path_start as usize ,
795
+ remaining,
796
+ ) ,
797
+ _ => {
798
+ self . parse_path ( scheme_type, & mut true , base_url. path_start as usize , input)
799
+ }
800
+ } ;
785
801
self . with_query_and_fragment (
786
802
scheme_type,
787
803
base_url. scheme_end ,
You can’t perform that action at this time.
0 commit comments