@@ -422,7 +422,11 @@ impl<'a> Parser<'a> {
422
422
. collect :: < String > ( )
423
423
!= "//"
424
424
} ) ;
425
- self . after_double_slash ( remaining, scheme_type, scheme_end)
425
+ if let Some ( after_prefix) = input. split_prefix ( "//" ) {
426
+ return self . after_double_slash ( after_prefix, scheme_type, scheme_end) ;
427
+ } else {
428
+ self . after_double_slash ( remaining, scheme_type, scheme_end)
429
+ }
426
430
}
427
431
SchemeType :: NotSpecial => self . parse_non_special ( input, scheme_type, scheme_end) ,
428
432
}
@@ -735,6 +739,9 @@ impl<'a> Parser<'a> {
735
739
debug_assert ! ( base_url. byte_at( scheme_end) == b':' ) ;
736
740
self . serialization
737
741
. push_str ( base_url. slice ( ..scheme_end + 1 ) ) ;
742
+ if let Some ( after_prefix) = input. split_prefix ( "//" ) {
743
+ return self . after_double_slash ( after_prefix, scheme_type, scheme_end) ;
744
+ }
738
745
return self . after_double_slash ( remaining, scheme_type, scheme_end) ;
739
746
}
740
747
let path_start = base_url. path_start ;
@@ -1132,7 +1139,11 @@ impl<'a> Parser<'a> {
1132
1139
".." | "%2e%2e" | "%2e%2E" | "%2E%2e" | "%2E%2E" | "%2e." | "%2E." | ".%2e"
1133
1140
| ".%2E" => {
1134
1141
debug_assert ! ( self . serialization. as_bytes( ) [ segment_start - 1 ] == b'/' ) ;
1135
- self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/../"
1142
+ if ends_with_slash {
1143
+ self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/../"
1144
+ } else {
1145
+ self . serialization . truncate ( segment_start) ; // Truncate ".."
1146
+ }
1136
1147
self . pop_path ( scheme_type, path_start) ;
1137
1148
// and then if neither c is U+002F (/), nor url is special and c is U+005C (\), append the empty string to url’s path.
1138
1149
if ends_with_slash && !self . serialization . ends_with ( "/" ) {
0 commit comments