MimeType parsing properly handles quoted semicolons

Issue:  SPR-14986
This commit is contained in:
Juergen Hoeller
2016-12-09 15:04:26 +01:00
parent a7ec6dc0af
commit 7714eeccf3
3 changed files with 48 additions and 21 deletions

View File

@@ -87,6 +87,16 @@ public class MimeTypeTests {
assertEquals("Invalid charset", StandardCharsets.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", StandardCharsets.UTF_8, mimeType.getCharset());
assertEquals("\"application/soap+xml;action=\\\"http://x.y.z\\\"\"", mimeType.getParameter("type"));
}
@Test
public void withConversionService() {
ConversionService conversionService = new DefaultConversionService();