![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
FF appends .txt to files served as text/plain when opening them with your application of choice
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
Opaite Mbohovái (5)
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\
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.
You need to inspect the .diff key as that is the file extension that is send.
- HKEY_CLASSES_ROOT\.diff
You can try to set browser.download.sanitize_non_media_extensions = false on the about:config page to see if that makes a difference.
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.