File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1139,8 +1139,15 @@ impl<'a> Parser<'a> {
1139
1139
".." | "%2e%2e" | "%2e%2E" | "%2E%2e" | "%2E%2E" | "%2e." | "%2E." | ".%2e"
1140
1140
| ".%2E" => {
1141
1141
debug_assert ! ( self . serialization. as_bytes( ) [ segment_start - 1 ] == b'/' ) ;
1142
- self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/.."
1142
+ // We dont want to truncate beyond the path start:
1143
+ if segment_start - 1 > path_start {
1144
+ self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/.."
1145
+ } else {
1146
+ self . serialization . truncate ( segment_start) ; // Truncate ".."
1147
+ }
1148
+
1143
1149
self . pop_path ( scheme_type, path_start) ;
1150
+
1144
1151
// 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.
1145
1152
if ends_with_slash && !self . serialization . ends_with ( "/" ) {
1146
1153
self . serialization . push ( '/' ) ;
You can’t perform that action at this time.
0 commit comments