mime types detection bug+regression (Linux)

Discussion of bugs in Mozilla Firefox
Post Reply
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

mime types detection bug+regression (Linux)

Post by Diorser »

Hello,
By anticipation, I know that Mozillazine is not Mozilla and not responsible of Firefox.
I never clearly understood which one was the "official" Mozilla forums among this list: mozilla_forums.

If someone knows a developer at Mozilla, he is welcome to provide him the message below.

The file association has never worked correctly in Firefox in a linux/KDE environment.
Firefox is not able to understand the mime types already defined in a system.
This is why ALL mimes need to be redefined for each new profile, and stored in handlers.json file.
Boring, but manageable.
I also never understood why Firefox was always asking again and again to be defined as default browser, although already the default browser.

Code: Select all

$ xdg-settings get default-web-browser 
firefox.desktop
Now, with recent Firefox releases, it becomes even worse, I don't know why.
As Firefox is not able to understand mimes already defined, in a KDE environment, Firefox (78) now asks to select an application in a pop-up window which is supposed to look in a database called "Discover", which is something totally optional I even have never used, and even did not know what it was.

Now the good news, I know this is a bug already identified by many (to not say all) Gtk applications, long time ago.

Firefox is very likely looking for mimes defined in either '/usr/share/applications/defaults.list' or '~/.local/share/applications/defaults.list', which are obsolete and may be still used by "gnome" / even not sure (see explanations @ April 2012: spacefm/issues)
»»» "xdg-open in its "open-generic" mode uses mimeapps.list, not defaults.list."

The correct default file to be used at user level to look for mimes is ~/.config/mimeapps.list , and nothing else.

It's probably really time to update Firefox to avoid extra mess with some "Discover" specific requirement.

+ more details @ XDG_MIME_Applications
Last edited by DanRaisch on July 16th, 2020, 4:23 am, edited 1 time in total.
Reason: (Linux) added to subject line.
User avatar
therube
Posts: 21714
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: mime types detection bug+regression (Linux)

Post by therube »

Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

Re: mime types detection bug+regression (Linux)

Post by Diorser »

Good finding. Then bug ported from 68 to 78 branch.

+ Bug 259356 Opened 16 years ago
Support for the Freedesktop.org XDG Base Directory Specification

The default for $XDG_CONFIG_HOME is $HOME/.config.
So all applications should look for those environment variables and use those default values if the variables are not set.
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

Re: mime types detection bug+regression (Linux)

Post by Diorser »

Some update which can be useful to KDE users (and others I don't know).

To save you time....:
▪ don't waste time creating firefox/distribution/policies.json to teach firefox the file associations
▪ don't waste time manually editing handlers.json file which is now useless (at least for me).

What I've done:
1 - to avoid confusion, total cleaning of handlers.json which content is just

Code: Select all

{"defaultHandlersVersion":{"fr":3},"mimeTypes":{}}
The preferences>applications window is empty, which is not a problem.

2 - Firefox is reading these files defined by these keys (see about:config):

Code: Select all

helpers.global_mime_types_file -> /etc/mime.types
helpers.private_mime_types_file -> ~/.mime.types
3 - Normally, all mimes are defined in /etc/mime.types which is a global file

4 - if Firefox does not understand a file extension, the key file to edit is ~/.config/mimeapps.list

Concrete example: firefox did not know how to open a zip file which should be opened with ark application.

1 - the mime type 'zip' is known by default /etc/mime.types

Code: Select all

$ grep zip /etc/mime.types
application/gzip     gz
application/zip       zip
2 - check zip application association
if not already defined in ~/.config/mimeapps.list, just add in ~/.config/mimeapps.list

Code: Select all

application/zip=org.kde.ark.desktop;
It works fine as a workaround, and avoid extra complexity with 'handlers.json' which is really hard to manage.

note: in KDE, '~/.config/mimeapps.list' can be graphically managed in systemsettings > Applications > associations, or direct access with:

Code: Select all

kcmshell5 filetypes
Post Reply