Support multiple base64 segments in Content-Disposition

See gh-28236
This commit is contained in:
Alex Lei
2022-03-27 10:36:16 +08:00
committed by Arjen Poutsma
parent 217117ced0
commit 195b622411
2 changed files with 15 additions and 1 deletions

View File

@@ -377,7 +377,13 @@ public final class ContentDisposition {
if (matcher.find()) {
charset = Charset.forName(matcher.group(1));
String encodedValue = matcher.group(2);
filename = new String(Base64.getDecoder().decode(encodedValue), charset);
StringBuilder sb = new StringBuilder(new String(Base64.getDecoder().decode(encodedValue), charset));
while (matcher.find()){
charset = Charset.forName(matcher.group(1));
encodedValue = matcher.group(2);
sb.append(new String(Base64.getDecoder().decode(encodedValue), charset));
}
filename = sb.toString();
}
else {
matcher = QUOTED_PRINTABLE_ENCODED_PATTERN.matcher(value);