当后面跟有 URL 参数时,Internet Explorer 会从下载中删除 .exe 扩展名
我现在从 Amazon S3 提供文件,并使用 API 生成安全 URL。除了在 IE 中下载 .exe 文件的人之外,在任何地方都可以正常工作。我已经在 IE 8 和 7 上对此进行了测试。
如果运行本地网络服务器,您可以通过将 notepad.exe 放入您的网络根目录来进行测试。 转到 http://localhost/notepad.exe (或同等内容) 现在尝试http://localhost/notepad.exe?
它应该将文件保存为记事本,不带扩展名。这是一个“功能”吗,因为谷歌搜索什么也没有得到。由于 IE 扩展的整个问题,您无法搜索有关文件扩展名的任何内容。
此外,如果文件名称中包含多个句点,有时会在末尾添加 [1] 或 []。
有什么想法吗?关于这种可怕行为的文档?看起来它一定是一个安全功能,但我还没有找到禁用它的选项。
一如既往,谢谢你。 蒂姆
I am serving files from Amazon S3 now, and I generate a secure URL using the API. Works great everywhere except for people downloading .exe files in IE. I have tested this on IE 8 and 7.
If running a local webserver you can test by putting notepad.exe in your web root.
Go to http://localhost/notepad.exe (or equivalent)
Now try http://localhost/notepad.exe?
It should save the file as notepad, without extension. Is this a 'feature' because googling it is coming up with nothing. Thanks to the whole issue of IE extensions, you can't search for anything on file extensions.
Also, if the file has multiple periods in the name, it sometimes gets a [1] or [] added to the end.
Any ideas? Docs on this terrible behavior? It seems like it must be a security feature, but I have yet to find an option to disable it.
And as always, thank you.
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 S3 提供文件时我们遇到了同样的问题。事实证明,您需要正确设置 IE 的内容处置才能正确处理文件。即HTTP头
Content-Disposition:attachment; filename="text.exe"
本文更详细地描述了:
http://www.jtricks.com/bits/content_disposition.html
We had the same problem when serving files from S3. Turns out you need to set the content-disposition correctly for IE to handle the files correctly. Namely, the HTTP header
Content-Disposition: attachment; filename="text.exe"
This article describes in a little more detail:
http://www.jtricks.com/bits/content_disposition.html
这里有一个很长的故事,但简单的解决方法是这样做:
http://www.example.com/dl/test.exe?mysecret=12321412&FixForIE=.exe
至于尾随的 [1] 或其他什么,不,你对此无能为力如果用户之前恰好从该 URL 下载过。
There's a long story here, but the simple workaround is to do this:
http://www.example.com/dl/test.exe?mysecret=12321412&FixForIE=.exe
As for the trailing [1] or whatnot, no, there's not really anything you can do about that if the user happens to have downloaded from that URL before.