如何阻止Firefox 102.x从我们的Web应用程序下载的文件的文件名中删除后缀(文件扩展)?
将Firefox从版本101.0更新为102.0之后,Firefox已开始从我们的Web应用程序之一下载的文件中删除后缀。同样,这在我的内存中的任何以前版本的Firefox中都从未发生过,并且相关的Web应用程序代码在一年之类的情况下没有变化。 Chrome和Safari继续保留下载文件的后缀。 Firefox 102.0更改文档未列出似乎适用的任何内容。
为什么Firefox这样做?是否有一些Firefox的偏好或配置,我们可以指示用户更改以制止它?
以下是代码输出的标题:
Content-Disposition: attachment; filename=foobar.ext
Content-Type: image/x-fits
对于记录,它不是常见的文件类型或后缀(扩展)。它用于专门的科学分析软件,但内容类型长期以来已被广泛认可。下载的文件不被压缩。
编辑:Firefox 102.1发行了,我仍然在此新版本中遇到这个问题。
我尝试过的事情:
- 更改内容分解:标头要在文件名周围添加双引号。
- 在用于下载文件的HTML中添加
下载=“ foobar.ext”
属于< a>
标签。
这两个变化都没有改善。
我发现了报告相同问题的Firefox用户的线程:
https://connect.mozilla.org/t5/discussions/downloads-missing-file-file-type-extension/mp/2790
这似乎是Firefox中的错误,Firefox开发人员正在积极地工作。相关的Bugzilla问题:
https://bugzilla.mozilla.org/show_bug.cgi?id=1778322 [meta]
https://bugzilla.mozilla.org/show_bug.cgi?id=1773907
After updating Firefox from version 101.0 to 102.0, Firefox has started to remove the suffixes from files downloaded from one of our web applications. Again, this has never happened in any previous version of Firefox in my memory, and the web application code in question hasn't changed in like a year. Chrome and Safari continue to both retain the suffixes of the files downloaded. The Firefox 102.0 changes document does not list anything that seems applicable to this.
Why is Firefox doing this? And is there some Firefox preference or configuration that we can instruct users to alter in order to stop it?
Here are the headers the code outputs:
Content-Disposition: attachment; filename=foobar.ext
Content-Type: image/x-fits
It's not a common file type or suffix (extension), for the record. It's for specialized scientific analysis software, but the content type has long been widely recognized. The downloaded file is not compressed.
EDIT: Firefox 102.1 was released, and I'm still having this issue with this new version.
Things I've tried:
- Changing the Content-Disposition: header to put double quotes around the filename.
- Adding a
download="foobar.ext"
attribute to the<a>
tag in the HTML used to download files.
Neither change improved things.
I found this thread of Firefox users reporting the same issue:
https://connect.mozilla.org/t5/discussions/downloads-missing-file-type-extension/m-p/2790
It appears to be a bug in Firefox which the Firefox developers are actively working on. Related Bugzilla issues:
https://bugzilla.mozilla.org/show_bug.cgi?id=1778322 [Meta]
https://bugzilla.mozilla.org/show_bug.cgi?id=1773907
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是Firefox 102:
https://bugzilla.mozilla.org/show_bugugug uggug ugug。 cgi?id = 1773907
i验证了Firefox开发人员在
This is a bug in Firefox 102:
https://bugzilla.mozilla.org/show_bug.cgi?id=1773907
I verified that the Firefox developers fixed it in the Firefox Nightly build dated 2022-07-12 and in the Firefox 103.0 general release.