Change '+' to spaces in file name during file download #237

GithubJohn3031 opened this Issue Apr 12, 2016 · 1 comment


None yet

2 participants


If filenames have spaces during download the spaces are changed to "+". So if file name is "my picture.jpg" Firefox loads a file as "my+picture.jpg". I've seen this issue only in Firefox, but possibly it occured also in another browsers.
I've found 2 places for file download in Omnifaces. The solution can be replacement of "+" to "%20". Tested with Ie8, Ie11, Firefox, Chrome


        externalContext.setResponseHeader("Content-Disposition", String.format(SENDFILE_HEADER,
            (attachment ? "attachment" : "inline"), encodeURL(filename)));


        externalContext.setResponseHeader("Content-Disposition", String.format(SENDFILE_HEADER,
            (attachment ? "attachment" : "inline"), encodeURL(filename).replace("+", "%20")));


String filename = encodeURL(getAttachmentName(request, resource.file));
BalusC commented Apr 19, 2016 edited

Fix is available in today's 2.4-SNAPSHOT.

Thank you for improving OmniFaces!

@BalusC BalusC closed this Apr 19, 2016
@BalusC BalusC added a commit that referenced this issue Apr 20, 2016
@BalusC BalusC #237: clarify encodeURI javadoc and fix FileServlet filename as well
(it's unnecessary on ETag and for backwards compatibility I'd rather not
change it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment