On 04/08/2024 00:37, Joseph Turner wrote:
jshttp/mime-types utility does this:

   // source preference (least -> most)
   var preference = ['nginx', 'apache', undefined, 'iana']

and then discards duplicate mappings which are of lower preference.

I can not say that I have consistent vision which way media type database should be designed. It is rather close to off-topic on this list (though `org-file-types' is a kind of override map, built-in mailcap.el is far from being perfect, and Emacs ignores shared-mime-info completely).

- Both fallback and override entries should be implemented.
- It seems there are differences which way custom entries should be handled during compiling database and when an application uses third party mappings. The reason is that version of external database may be older or newer than version of an application. Some conflicts may cause fatal error during compiling of database while applications have to be more intelligent in respect to conflict resolution. - Priorities of media type to suffix and suffix to media type may be different. - My impression is that multiple types may have the same suffix, so there should be "get all media types for given suffix" method.
- It should be possible to specify priorities within the same source.

I am a bit surprised that jshttp/mime-types developers use added entries as fallback, not as overrides for IANA, but it is their design decision. Since it is a DB, not DB user, they can just drop conflicting entries. Perhaps they still want to preserve ambiguous mapping of multiple media types to the same suffix (otherwise text/x-org should be dropped due to a conflict).

Max Nikulin writes:
I think, text/org may be added as well (without removing of
text/x-org).

Shall we consider this this after we find a way for these low-preference
mappings to be useful?

I still believe that the following behavior is preferable

- applicaion/vnd.lotus-organizer -> .org
- text/x-org -> .org
- text/org -> .org
- .org -> text/org (preferably without relying on x- heuristics)

Unless a user explicitly configured local mapping .org to applicaion/vnd.lotus-organizer

Reply via email to