@@ -440,7 +440,11 @@ impl<'a> Parser<'a> {
440
440
. collect :: < String > ( )
441
441
!= "//"
442
442
} ) ;
443
- self . after_double_slash ( remaining, scheme_type, scheme_end)
443
+ if let Some ( after_prefix) = input. split_prefix ( "//" ) {
444
+ return self . after_double_slash ( after_prefix, scheme_type, scheme_end) ;
445
+ } else {
446
+ self . after_double_slash ( remaining, scheme_type, scheme_end)
447
+ }
444
448
}
445
449
SchemeType :: NotSpecial => self . parse_non_special ( input, scheme_type, scheme_end) ,
446
450
}
@@ -753,6 +757,9 @@ impl<'a> Parser<'a> {
753
757
debug_assert ! ( base_url. byte_at( scheme_end) == b':' ) ;
754
758
self . serialization
755
759
. push_str ( base_url. slice ( ..scheme_end + 1 ) ) ;
760
+ if let Some ( after_prefix) = input. split_prefix ( "//" ) {
761
+ return self . after_double_slash ( after_prefix, scheme_type, scheme_end) ;
762
+ }
756
763
return self . after_double_slash ( remaining, scheme_type, scheme_end) ;
757
764
}
758
765
let path_start = base_url. path_start ;
@@ -1150,7 +1157,11 @@ impl<'a> Parser<'a> {
1150
1157
".." | "%2e%2e" | "%2e%2E" | "%2E%2e" | "%2E%2E" | "%2e." | "%2E." | ".%2e"
1151
1158
| ".%2E" => {
1152
1159
debug_assert ! ( self . serialization. as_bytes( ) [ segment_start - 1 ] == b'/' ) ;
1153
- self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/../"
1160
+ if ends_with_slash {
1161
+ self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/../"
1162
+ } else {
1163
+ self . serialization . truncate ( segment_start) ; // Truncate ".."
1164
+ }
1154
1165
self . pop_path ( scheme_type, path_start) ;
1155
1166
// 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.
1156
1167
if ends_with_slash && !self . serialization . ends_with ( "/" ) {
0 commit comments