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 @@ -1157,8 +1157,15 @@ impl<'a> Parser<'a> {
1157
1157
".." | "%2e%2e" | "%2e%2E" | "%2E%2e" | "%2E%2E" | "%2e." | "%2E." | ".%2e"
1158
1158
| ".%2E" => {
1159
1159
debug_assert ! ( self . serialization. as_bytes( ) [ segment_start - 1 ] == b'/' ) ;
1160
- self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/.."
1160
+ // We dont want to truncate beyond the path start:
1161
+ if segment_start - 1 > path_start {
1162
+ self . serialization . truncate ( segment_start - 1 ) ; // Truncate "/.."
1163
+ } else {
1164
+ self . serialization . truncate ( segment_start) ; // Truncate ".."
1165
+ }
1166
+
1161
1167
self . pop_path ( scheme_type, path_start) ;
1168
+
1162
1169
// 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.
1163
1170
if ends_with_slash && !self . serialization . ends_with ( "/" ) {
1164
1171
self . serialization . push ( '/' ) ;
You can’t perform that action at this time.
0 commit comments