Support escape character in ContentDisposition

Closes gh-23077
This commit is contained in:
Rossen Stoyanchev
2019-06-03 16:03:35 -04:00
parent 4523d01a50
commit 4f05da7fed
2 changed files with 12 additions and 2 deletions

View File

@@ -79,6 +79,14 @@ public class ContentDispositionTests {
.filename("中文.txt", StandardCharsets.UTF_8).build(), disposition);
}
@Test // gh-23077
public void parseWithEscapedQuote() {
ContentDisposition disposition = ContentDisposition.parse(
"form-data; name=\"file\"; filename=\"\\\"The Twilight Zone\\\".txt\"; size=123");
assertEquals(ContentDisposition.builder("form-data").name("file")
.filename("\\\"The Twilight Zone\\\".txt").size(123L).build(), disposition);
}
@Test(expected = IllegalArgumentException.class)
public void parseEmpty() {
ContentDisposition.parse("");