File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -624,7 +624,11 @@ private static String decodeQuotedPairs(String filename) {
624
624
char c = filename .charAt (i );
625
625
if (filename .charAt (i ) == '\\' && i + 1 < length ) {
626
626
i ++;
627
- sb .append (filename .charAt (i ));
627
+ char next = filename .charAt (i );
628
+ if (next != '"' && next != '\\' ) {
629
+ sb .append (c );
630
+ }
631
+ sb .append (next );
628
632
}
629
633
else {
630
634
sb .append (c );
Original file line number Diff line number Diff line change @@ -169,6 +169,14 @@ void parseBackslashInLastPosition() {
169
169
assertThat (cd .toString ()).isEqualTo ("form-data; name=\" foo\" ; filename=\" bar\\ \\ \" " );
170
170
}
171
171
172
+ @ Test
173
+ void parseWindowsPath () {
174
+ ContentDisposition cd = ContentDisposition .parse ("form-data; name=\" foo\" ; filename=\" D:\\ foo\\ bar.txt\" " );
175
+ assertThat (cd .getName ()).isEqualTo ("foo" );
176
+ assertThat (cd .getFilename ()).isEqualTo ("D:\\ foo\\ bar.txt" );
177
+ assertThat (cd .toString ()).isEqualTo ("form-data; name=\" foo\" ; filename=\" D:\\ \\ foo\\ \\ bar.txt\" " );
178
+ }
179
+
172
180
173
181
@ SuppressWarnings ("deprecation" )
174
182
@ Test
You can’t perform that action at this time.
0 commit comments