Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion java/src/main/java/com/genexus/webpanels/WebUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public static String getEncodedContentDisposition(String value, int browserType)
}

String filename = value.substring(eqIdx + 1).trim();
value = value.substring(0, filenameIdx) + String.format("filename*=UTF-8''%1$s; filename=\"%1$s\"", PrivateUtilities.URLEncode(filename, "UTF8"));
value = value.substring(0, filenameIdx) + String.format("filename*=UTF-8''%1$s; filename=\"%1$s\"", PrivateUtilities.URLEncode(filename, "UTF8").replace('+', ' '));

return value;
}
Expand Down
6 changes: 6 additions & 0 deletions java/src/test/java/com/genexus/webpanels/TestWebUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public void TestContentDispositionHeaderEncoding6() {
doTest(contentDisposition, expectedContentDisposition);
}

@Test
public void TestContentDispositionHeaderEncoding7() {
String contentDisposition = "attachment; filename=My file.pdf";
String expectedContentDisposition = "attachment; filename*=UTF-8''My file.pdf; filename=\"My file.pdf\"";
doTest(contentDisposition, expectedContentDisposition);
}

private void doTest(String contentDisposition, String expectedContentDisposition) {
doTest(contentDisposition, expectedContentDisposition, HttpContextWeb.BROWSER_CHROME);
Expand Down