Skip to content

Commit

Permalink
fix: now uses utf8 when setting content-dispostion filename (#1583)
Browse files Browse the repository at this point in the history
windows defaults to windows-1252 which is not compliant with rfc5987 that governs how to encode header fields

Fixes #1556
  • Loading branch information
paulcwarren authored Aug 24, 2023
1 parent 47872b1 commit 5d90617
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.Date;
import java.util.stream.Stream;
Expand Down Expand Up @@ -193,7 +194,7 @@ public HttpHeaders getResponseHeaders() {
// Modified to show download
Object originalFileName = this.getContentProperty().getOriginalFileName(this.getAssociation());
if (originalFileName != null && StringUtils.hasText(originalFileName.toString())) {
headers.setContentDisposition(ContentDisposition.attachment().filename((String) originalFileName, Charset.defaultCharset()).build());
headers.setContentDisposition(ContentDisposition.attachment().filename((String) originalFileName, StandardCharsets.UTF_8).build());
} else {
headers.setContentDisposition(ContentDisposition.attachment().build());
}
Expand Down

0 comments on commit 5d90617

Please sign in to comment.