Details
Description
When downloading a file with spaces and non-ASCII characters in the filename using DownloadLink, all browsers I tested show a wrong filename in the file download dialog.
For a file named Test 'ä'.txt, I got the following output from different browsers:
IE: Test+'ä'.txt
FF: Test+%27%C3%A4%27.txt
Chrome: Test+%27ä%27.txt
I have attached a patch that fixes the issue for me. The problem is that
a) the used URL encoding is wrong. PATH encoding, not QUERY encoding is required
b) only IE needs the filename to be encoded, other browsers seem to work with the original name
See e.g. http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http for a discussion of the underlying issue.
Note: I do not believe the attached patch is the optimal fix for this issue. I would prefer removing the encoding handling from DownloadLink and putting it into AbstractResource.setResponseHeaders(), so other components using attachments benefit, too.
Attachments
Attachments
Issue Links
- relates to
-
WICKET-6010 Downloading filenames containing ',' or ';' gives problems
- Resolved
-
WICKET-1115 DownloadLink fix that encodes non-ASCII file names properly
- Resolved