I have a problem with IE8 where URLs with query strings are being mangled on download.
In particular, a URL like
http://domain.com/software/Software%202.1%20Beta.exe?AWSAccessKeyId=1HCB7Z221V5CV2K1ZDG2&Expires=1307910775&Signature=iQ11pHtVrFS6Up171MI1%2BK3ErPo%3D
Is causing IE8 to give a file download notification for a file called
Software 2.1%20Beta[1].exe
I'm completely lost as to why the first '%20' is being correctly translated by IE into a space, but the second %20
remains as-is, while the extension is dropped and a [1]
is appended.
Removing the trailing query string is not an option (expiring S3 links). Do you guys have any suggestions to get around this madness? Am I doing something wrong with my URI encoding?
Aha!
Solved by adding the non-standard HTTP Content-Disposition header, which aside from being a complete abomination, is used by IE to override any other auto-naming factor.
Content-Disposition: attachment; filename="My Program 2.1.0 Beta.exe"
Content-Disposition takes the filename in ISO-Latin encoding, i.e. no HTML encoding nonsense, but technically also no UTF8 characters, which for me isn't a problem.
Turns out you can specify this from the AWS Management Console's file browser. Only wish there were some way for it to automatically serve the Content-Disposition header without my having to shoe-horn it in for each and every download I'm serving >.<
EDIT:
aaaaand I spoke too soon. Amazon has added a feature for this: http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectGET.html wherein one can manually request that the file be served with a particular Content-Disposition header, which means that Amazon and the AWS team really do rock!