File tree 2 files changed +14
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,12 @@ else if (!isQuotedString(value)) {
376
376
}
377
377
378
378
private boolean isQuotedString (String s ) {
379
- return s .length () > 1 && s .startsWith ("\" " ) && s .endsWith ("\" " ) ;
379
+ if (s .length () < 2 ) {
380
+ return false ;
381
+ }
382
+ else {
383
+ return ((s .startsWith ("\" " ) && s .endsWith ("\" " )) || (s .startsWith ("'" ) && s .endsWith ("'" )));
384
+ }
380
385
}
381
386
382
387
private String unquote (String s ) {
Original file line number Diff line number Diff line change @@ -181,6 +181,14 @@ public void parseMediaTypeQuotedParameterValue() {
181
181
assertEquals ("\" v>alue\" " , mediaType .getParameter ("attr" ));
182
182
}
183
183
184
+ // SPR-8917
185
+
186
+ @ Test
187
+ public void parseMediaTypeSingleQuotedParameterValue () {
188
+ MediaType mediaType = MediaType .parseMediaType ("audio/*;attr='v>alue'" );
189
+ assertEquals ("'v>alue'" , mediaType .getParameter ("attr" ));
190
+ }
191
+
184
192
@ Test (expected = IllegalArgumentException .class )
185
193
public void parseMediaTypeIllegalQuotedParameterValue () {
186
194
MediaType .parseMediaType ("audio/*;attr=\" " );
You can’t perform that action at this time.
0 commit comments