为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

When I ask to save a file, the save dialog box in Firefox deletes the file extension (e.g., "doc", "pdf", "ofx") from the filename. I am using version 66.0.2

more options

When I ask to save a file, the save dialog box in Firefox deletes the file extension (e.g., "doc", "pdf", "ofx") from the filename. I am using version 66.0.2

The same file download works in chrome.

When I ask to save a file, the save dialog box in Firefox deletes the file extension (e.g., "doc", "pdf", "ofx") from the filename. I am using version 66.0.2 The same file download works in chrome.

被采纳的解决方案

Are you generating something like this:

Content-Disposition: attachment;filename="Test Widget Rename.json";

You could double-check that Firefox received it using the Network Monitor, if the download opens in the same tab. Note that the monitor doesn't start logging until you open it:

  • "3-bar" menu button > Web Developer > Network
  • (menu bar) Tools > Web Developer > Network
  • (Mac) Command+Alt+e
  • (Windows) Ctrl+Shift+e

When you click the request for the download, the Response Headers usually are displayed in the right side by default but, if another panel is selected, click Headers.

定位到答案原位置 👍 0

所有回复 (6)

more options

Hi LearningAboutTech, that definitely shouldn't happen. Is that the only part cut off?

A known issue is that Firefox stops at the first space in the file name if the site didn't put quotation marks around it when sending it. Most sites do it right, but there are some exceptions. But any space in the name usually would be way before the file extension, so that may be unrelated.

Does it help to set Finder to show all file extensions? In Finder, click the Finder menu, then Preferences, then on the Advanced panel, check the box for "Show all filename extensions".

more options

Hi JSCHER - Thank you for you reply. The server is owned by me - yes the file name from the server looks like "Test Download" ( double quotation marks around filename).

The extension(.json) is still missing. I would want the extension to be showed to make the experience across browsers the same.

more options

选择的解决方案

Are you generating something like this:

Content-Disposition: attachment;filename="Test Widget Rename.json";

You could double-check that Firefox received it using the Network Monitor, if the download opens in the same tab. Note that the monitor doesn't start logging until you open it:

  • "3-bar" menu button > Web Developer > Network
  • (menu bar) Tools > Web Developer > Network
  • (Mac) Command+Alt+e
  • (Windows) Ctrl+Shift+e

When you click the request for the download, the Response Headers usually are displayed in the right side by default but, if another panel is selected, click Headers.

more options

Hi - Yes using the content disposition header. The file is being downloaded in a seperate tab and hence I am not sure how can I can inspect in a seperate tab.

``` response.setHeader(PlatformService.Constants.CONTENT_DISPOSITION,"attachment;filename=" + fileName + ".json");```

more options

(Sorry, no markdown here. You can use <pre> and </pre> around blocks you don't want to wrap, or <code> and </code> to use a monospace font but allow wrapping.)

response.setHeader(PlatformService.Constants.CONTENT_DISPOSITION, "attachment;filename=" + fileName + ".json");

Is that Node, or Java, or .Net, or ???

You need more quotation marks inside your quotation marks. If you can use ' interchangeably with " then try this:

response.setHeader(PlatformService.Constants.CONTENT_DISPOSITION, 'attachment;filename="' + fileName + '.json"');

If your language or style guidelines don't allow using ' in place of " then use whatever method of escaping you need to achieve the same effect.

Success?

more options

That helped - Thank you for your time!