File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
main/java/org/springframework/util
test/java/org/springframework/util Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -288,8 +288,8 @@ else if (ch == '"') {
288
288
}
289
289
int eqIndex = parameter .indexOf ('=' );
290
290
if (eqIndex >= 0 ) {
291
- String attribute = parameter .substring (0 , eqIndex );
292
- String value = parameter .substring (eqIndex + 1 , parameter .length ());
291
+ String attribute = parameter .substring (0 , eqIndex ). trim () ;
292
+ String value = parameter .substring (eqIndex + 1 , parameter .length ()). trim () ;
293
293
parameters .put (attribute , value );
294
294
}
295
295
}
Original file line number Diff line number Diff line change @@ -241,6 +241,18 @@ public void parseMimeTypeSingleQuotedParameterValue() {
241
241
assertEquals ("'v>alue'" , mimeType .getParameter ("attr" ));
242
242
}
243
243
244
+ @ Test // SPR-16630
245
+ public void parseMimeTypeWithSpacesAroundEquals () {
246
+ MimeType mimeType = MimeTypeUtils .parseMimeType ("multipart/x-mixed-replace;boundary = --myboundary" );
247
+ assertEquals ("--myboundary" , mimeType .getParameter ("boundary" ));
248
+ }
249
+
250
+ @ Test // SPR-16630
251
+ public void parseMimeTypeWithSpacesAroundEqualsAndQuotedValue () {
252
+ MimeType mimeType = MimeTypeUtils .parseMimeType ("text/plain; foo = \" bar \" " );
253
+ assertEquals ("\" bar \" " , mimeType .getParameter ("foo" ));
254
+ }
255
+
244
256
@ Test (expected = InvalidMimeTypeException .class )
245
257
public void parseMimeTypeIllegalQuotedParameterValue () {
246
258
MimeTypeUtils .parseMimeType ("audio/*;attr=\" " );
You can’t perform that action at this time.
0 commit comments