Reputation: 1836
I have a page on my GWT & App Engine application that is basically a table of files that the user has uploaded.
Here is the last part of the doGet function of BlobServiceImpl, that serves the blobs when the user requests:
// got the entity already
filename = (String) entity.getProperty("filename");
resp.addHeader("Content-Disposition", "filename=" + filename);
blobstoreService.serve(blobKey, resp);
The code above gets the filename from the entity metadata, set the filename in the HttpServletResponse and then serve the actual blob.
The problem I am having is that for files with a space in the filename, Firefox sets the filename to the first word only - everything after the space is excluded. This is quite annoying as a file called "My Amazing File.xls" will be saved as "My".
Something to do with the character encoding perhaps? Strange that it works fine in other browsers.
Thanks for helping :)
Upvotes: 1
Views: 279
Reputation: 1836
As Amy has said, this is a Firefox problem, nothing to do with App Engine.
Changing this:
resp.addHeader("Content-Disposition", "filename=" + filename);
To this:
resp.addHeader("Content-Disposition", "filename=\"" + filename + "\"");
fixed my problem.
Happy coding!
Upvotes: 1
Reputation: 1017
You'll probably want to use a urlencode function on the filenames so that the " " become "%20".
Upvotes: 0