This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

FF appends .txt to files served as text/plain when opening them with your application of choice

  • 5 replies
  • 1 has this problem
  • 1 view
  • Last reply by bartjunk64

more options

I'm on Windows 10.

I have told my FF to open *.diff files in my preferred text editor (which supports syntax highlighting). Now it seems that if a webserver serves this file as "content-type text/plain", FF will download the file in a temp folder, add the .txt extension (on top of the .diff extension the file has), then invokes the preferred application to open that file.

E.g. https://gitlab.com/freepascal.org/lazarus/lazarus/uploads/ccec59aabbef6cbe00df39bfd57f565a/checkbox.diff is downloaded to my system as C:\users\username\AppData\Local\Temp\checkbox.diff.txt and then this filename will be passed as a paramater to my editor.

In contrast, when I download the file (choose "save file" from the dialog) and then from the "downloads menu" choose "open", the file will be downloaded without FF altering the file extension, and will open as expected.

How can I persuade FF to NOT append a .txt to that file when I ask to open it in my preferred application?

Notice that on Linux Mint 18.0, FF does NOT append a .txt to the file in the example above and opens it in Kate (my default editor there) as simply path/to/checkbox.diff

I'm on Windows 10. I have told my FF to open *.diff files in my preferred text editor (which supports syntax highlighting). Now it seems that if a webserver serves this file as "content-type text/plain", FF will download the file in a temp folder, add the .txt extension (on top of the .diff extension the file has), then invokes the preferred application to open that file. E.g. https://gitlab.com/freepascal.org/lazarus/lazarus/uploads/ccec59aabbef6cbe00df39bfd57f565a/checkbox.diff is downloaded to my system as C:\users\username\AppData\Local\Temp\checkbox.diff.txt and then this filename will be passed as a paramater to my editor. In contrast, when I download the file (choose "save file" from the dialog) and then from the "downloads menu" choose "open", the file will be downloaded without FF altering the file extension, and will open as expected. How can I persuade FF to NOT append a .txt to that file when I ask to open it in my preferred application? Notice that on Linux Mint 18.0, FF does NOT append a .txt to the file in the example above and opens it in Kate (my default editor there) as simply path/to/checkbox.diff

All Replies (5)

more options

This could be a problem with the MIME database key in the Windows Registry.

You can inspect the MIME database key 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 a possibly linked MIME type in the MIME Database registry key.

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

Computer\HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/plain Extension REG_SZ .txt

Computer\HKEY_CLASSES_ROOT\.txt (default) REG_SZ txtfile ContentType REG_SZ text/plain PerceivedType REG_SZ txt

That looks pretty standard to me.

more options

You need to inspect the .diff key as that is the file extension that is send.

  • HKEY_CLASSES_ROOT\.diff
more options

You can try to set browser.download.sanitize_non_media_extensions = false on the about:config page to see if that makes a difference.

more options

HKEY_CLASSES_ROOT\.diff (default) REG_SZ diff_auto_file

HKEY_CLASSES_ROOT\diff_auto_file (default) REG_SZ (no value)

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.diff\UserChoice ProgID REG_SZ Applications/Eplus.exe (my preferred editor)

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts has a key named Applications/EPlus.exe_.diff (which is similar to other applications and theire associated extensions)

TBH I don't really see the relevance. Double clicking on a diff file in Explorer worsk just fine (opens in EPlus.exe) Downloading (save file) in said FF dialog works just fine.

It is FF that appands the unwanted and unneeded .txt extension to that file.