Content-Disposition can parse BASE64 encoded filename

See gh-26463
This commit is contained in:
Yusuke Yamamoto
2021-01-28 11:48:22 +09:00
committed by Rossen Stoyanchev
parent cd80b6b4ac
commit a264013d7a
2 changed files with 24 additions and 1 deletions

View File

@@ -80,6 +80,18 @@ class ContentDispositionTests {
.build());
}
@Test
void parseBase64EncodedUTF8Filename() {
assertThat(parse("attachment; filename=\"=?UTF-8?B?5pel5pys6KqeLmNzdg==?=\"").getFilename())
.isEqualTo("日本語.csv");
}
@Test
void parseBase64EncodedShiftJISFilename() {
assertThat(parse("attachment; filename=\"=?SHIFT_JIS?B?k/qWe4zqLmNzdg==?=\"").getFilename())
.isEqualTo("日本語.csv");
}
@Test
void parseEncodedFilenameWithoutCharset() {
assertThat(parse("form-data; name=\"name\"; filename*=test.txt"))