MimeType parsing properly handles quoted semicolons

Issue:  SPR-14986
(cherry picked from commit 7714eec)
This commit is contained in:
Juergen Hoeller
2016-12-09 15:04:26 +01:00
parent dd3c370bca
commit 84d8135cbb
3 changed files with 47 additions and 21 deletions

View File

@@ -87,6 +87,16 @@ public class MimeTypeTests {
assertEquals("Invalid charset", Charset.forName("UTF-8"), mimeType.getCharset());
}
@Test
public void parseQuotedSeparator() {
String s = "application/xop+xml;charset=utf-8;type=\"application/soap+xml;action=\\\"http://x.y.z\\\"\"";
MimeType mimeType = MimeType.valueOf(s);
assertEquals("Invalid type", "application", mimeType.getType());
assertEquals("Invalid subtype", "xop+xml", mimeType.getSubtype());
assertEquals("Invalid charset", Charset.forName("UTF-8"), mimeType.getCharset());
assertEquals("\"application/soap+xml;action=\\\"http://x.y.z\\\"\"", mimeType.getParameter("type"));
}
@Test
public void withConversionService() {
ConversionService conversionService = new DefaultConversionService();