為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

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

了解更多

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

  • 5 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 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

所有回覆 (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.