File tree 2 files changed +9
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ public static ContentDisposition parse(String contentDisposition) {
252
252
String part = parts .get (i );
253
253
int eqIndex = part .indexOf ('=' );
254
254
if (eqIndex != -1 ) {
255
- String attribute = part .substring (0 , eqIndex );
255
+ String attribute = part .substring (0 , eqIndex ). toLowerCase () ;
256
256
String value = (part .startsWith ("\" " , eqIndex + 1 ) && part .endsWith ("\" " ) ?
257
257
part .substring (eqIndex + 2 , part .length () - 1 ) :
258
258
part .substring (eqIndex + 1 ));
Original file line number Diff line number Diff line change @@ -180,6 +180,14 @@ void parseWithExtraSemicolons() {
180
180
.build ());
181
181
}
182
182
183
+ @ Test
184
+ void parseAttributesCaseIgnore () {
185
+ ContentDisposition cd = ContentDisposition .parse ("form-data; Name=\" foo\" ; FileName=\" bar.txt\" " );
186
+ assertThat (cd .getName ()).isEqualTo ("foo" );
187
+ assertThat (cd .getFilename ()).isEqualTo ("bar.txt" );
188
+ assertThat (cd .toString ()).isEqualTo ("form-data; name=\" foo\" ; filename=\" bar.txt\" " );
189
+ }
190
+
183
191
@ Test
184
192
void parseEmpty () {
185
193
assertThatIllegalArgumentException ().isThrownBy (() -> parse ("" ));
You can’t perform that action at this time.
0 commit comments