-
Bug
-
Resolution: Fixed
-
Normal
-
8.5.0
-
Security Level: Jimmy
-
None
-
ZK 8.5.1 R1
-
None
Steps to Reproduce
Filedownload.save("test content", "text/plain", "test#test.txt");
Current Result
will download the file as test.txt omitting #test
Expected Result
file downloaded as test#test.txt
Debug Info
in DesktopImpl.getDownloadMediaURI special characters inside the file name like "#?&" need to be %-encoded to avoid file name truncation
see: https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
Workaround
split download code such as ...
Filedownload.save("test content", "text/plain", "test#test.txt");
... into ...
AMedia media = new AMedia("test#test.txt", "txt", "text/plain", "test content"); Clients.response(new AuDownload((DeferredValue) () -> Executions.getCurrent().getDesktop().getDownloadMediaURI(media, "test#test.txt").replace("#", "%23")));
... allowing to encode special chars as needed
-------------
Alternative is to override the getDownloadMediaURI method by extending DesktopImpl and configure a custom webapp factory to return instances of the custom DesktopImpl class