1

I've asked a related question on AskUbuntu (How to open *.htm differently than *.html?) with no interest yet, so I'm addressing the same issue with a more fundamental question.

I cannot find how and where in GNOME the MIME type text/html is assigned, usually (but not always) to web page files (*.html and *.htm). There are at least 2 rules at work: it's partially related to the file extension as well as a variable number of characters at the beginning of the file (testing on GNOME 3.28.2 / Ubuntu 18.04):

$ ls -l empty.html
-rw-r--r-- 1 rphair rphair 0 2019-08-02 16:26 empty.html
$ gio info empty.html | grep standard::content-type
  standard::content-type: text/plain

$ cat less-than.html
<
$ gio info less-than.html | grep standard::content-type
  standard::content-type: text/html

$ mv less-than.html less-than.junk
$ gio info less-than.junk | grep standard::content-type
  standard::content-type: text/plain

$ echo '<html' > less-than.junk
$ gio info less-than.junk | grep standard::content-type
  standard::content-type: text/html

I need to know where this MIME type is defined as such, so I can change that definition. (This goes a bit beyond the scope of this question, but my goal is to associate *.htm files of the same MIME classification with a web editor rather than a browser.)

0

Existing MIME types for installed packages are defined in /usr/share/mime/packages. Commonly accepted MIME types are defined in freedesktop.org.xml in this directory. The content of this database is defined here (freedesktop.org > Specifications > shared-mime-info-spec) as well as the procedure by which standard MIME types are added or modified.

Custom MIME types can be defined by placing files according to:

How to override standard MIME types (for the system in question, defined in package shared-mime-info), particularly text/html, is an answer to the related question, so I'll address it in the linked thread on the other forum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.