Skip to content

Fix: updating method name to match rfc (RFC5987) #11675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 4.9.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void process(MutableHttpResponse<?> response) {
static String buildAttachmentHeader(String attachmentName) {
// https://httpwg.org/specs/rfc6266.html#advice.generating
// 'filename' parameter is the fallback for legacy browsers, 'filename*' is the supported approach.
return "attachment; filename=\"" + sanitizeAscii(attachmentName) + "\"; filename*=utf-8''" + encodeRfc6987(attachmentName);
return "attachment; filename=\"" + sanitizeAscii(attachmentName) + "\"; filename*=utf-8''" + encodeRfc5987(attachmentName);
}

private static String sanitizeAscii(String s) {
Expand All @@ -157,7 +157,7 @@ private static String sanitizeAscii(String s) {
// this is mostly copied from netty QueryStringEncoder

@SuppressWarnings({"java:S3776", "java:S135", "java:S127"}) // stay close to netty impl
static String encodeRfc6987(String s) {
static String encodeRfc5987(String s) {
StringBuilder uriBuilder = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
Expand Down
Loading