搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Firefox changes file extension when downloading

more options

We are building a web based application where you can download different kinds of files, e.g. PDF and DOCX files. Direct links are provided to these.

In Chrome, IE, Opera - all of the files download as expected (or open up if there is a specific setting for that type of file). Not so with Firefox.

Upon clicking, a dialogue opens and asks if the file should be downloaded or opened. In this dialoge, no file extension is displayed. Opening the file works both for docx and pdf with MS word and Acrobat Reader installed. Fine.

But downloading is strange: the file is downloaded, but in case of the PDF, the file extension is cut off (missing completely!). In case of the docx file, firefox downloads the file with a .doc extension! If I manually correct the extensions, all is OK. Why does Firefox mess around with the file extensions of downloaded files? Can it be turned off or fixed without losing compatibility to other browsers? Using Win7 and ffx 38.0.5

We are building a web based application where you can download different kinds of files, e.g. PDF and DOCX files. Direct links are provided to these. In Chrome, IE, Opera - all of the files download as expected (or open up if there is a specific setting for that type of file). Not so with Firefox. Upon clicking, a dialogue opens and asks if the file should be downloaded or opened. In this dialoge, no file extension is displayed. Opening the file works both for docx and pdf with MS word and Acrobat Reader installed. Fine. But downloading is strange: the file is downloaded, but in case of the PDF, the file extension is cut off (missing completely!). In case of the docx file, firefox downloads the file with a .doc extension! If I manually correct the extensions, all is OK. Why does Firefox mess around with the file extensions of downloaded files? Can it be turned off or fixed without losing compatibility to other browsers? Using Win7 and ffx 38.0.5

所有回覆 (10)

more options

Please first make sure that all of these settings are the way the should be:

Next please make sure it is not a malicious add on or extension and check to see if this also happens in Firefox Safe Mode:

Try Firefox Safe Mode to see if the problem goes away. Firefox Safe Mode is a troubleshooting mode that temporarily turns off hardware acceleration, resets some settings, and disables add-ons (extensions and themes).

If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:

  • Click the menu button New Fx Menu, click Help Help-29 and select Restart with Add-ons Disabled.

If Firefox is not running, you can start Firefox in Safe Mode as follows:

  • On Windows: Hold the Shift key when you open the Firefox desktop or Start menu shortcut.
  • On Mac: Hold the option key while starting Firefox.
  • On Linux: Quit Firefox, go to your Terminal and run firefox -safe-mode
    (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)

When the Firefox Safe Mode window appears, select "Start in Safe Mode".

SafeMode-Fx35

If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, theme, or hardware acceleration. Please follow the steps in the Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems article to find the cause.

To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.

When you figure out what's causing your issues, please let us know. It might help others with the same problem.

more options

Hi,

I have the same issue if I restart Firefox in safe mode. I have tested with multiple computers and different Firefox profiles - all have the same behaviour.

It is also independent of the download actions. The files ARE downloaded, but the file extension is cut off.

Regards, jaktrip

more options

Try to rename (or delete) the mimeTypes.rdf file in the Firefox profile folder to reset all file actions.

You can use this button to go to the currently used Firefox profile folder:

more options

This is going in the wrong direction. We are a software developer. Our website must function with different browsers. It doesn't help if we can fix this issue with one particular Firefox installation. It must work for our clients.

As said, we have tested our website with the newest Firefox, Chroma, IE, Opera on multiple computers. Chrome, IE and Opera work fine. Firefox cuts off the file extensions when downloading the files. All of the 3 Firefox installations we tested, also in safe mode, with the default mime type settings in place after a fresh install.

The problem may be in our html/angularJS code OR in the standard Firefox package, NOT in specific settings.

I begin to believe it is a AngularJS problem. However all other browsers (chorme, IE, Opera, Safari) work fine.

more options

Try to ask advice at the Stack Overflow forum site.

more options

Attention Sumos, I have seen several posts with the same problem.

more options

I have been browsing stack overflow and what I get is the confirmation that it is indeed a Bug in Firefox, and there seems to be no remedy.

http://stackoverflow.com/questions/28874759/force-firefox-not-to-change-file-extension

more options

Can you post a public link to a web page?

more options

This would normally only happen if there is a problem with the mimeTypes.rdf or with the MIME database key in the Windows registry.

You can Inspect the MIME database with the registry editor (regedit.exe) and do a search for that MIME type (file extension) via Ctrl+F. Be cautious with editing the registry as there is NO UNDO possible: all changes are applied immediately. You can export key(s) in the registry editor before making changes. You can check specific file extension keys (e.g. .jpg) in the registry with the registry editor.

  • HKEY_CLASSES_ROOT\.xxx

You can check the linked MIME type in the MIME Database registry key.

  • HKEY_CLASSES_ROOT\MIME\Database\Content Type\
more options

This seems like a different issue than .bat and .reg files, which are fairly uncommon for serving over the web and so possibly defaulted to a text/plain content type.

Can you reproduce the error with DOCX files from other sites, such as Microsoft? Here are some samples:

filetype:DOCX site:microsoft.com - Bing

What about PDF files from other sites? None of them save with the extension, or is the problem only in the app?