Max Nikulin <maniku...@gmail.com> writes:

> On 02/08/2024 02:55, Joseph Turner wrote:
>> Support for "text/org" in <https://github.com/jshttp/mime-db> would
>> let
>> the Agregore browser (<https://agregore.mauve.moe/>) render Org
>> files.
>> Then hyperdrive.el users could share Org files to be viewed in
>> Agregore.
>> John Kitchin opened a PR back in 2017, which was rejected:
>> https://github.com/jshttp/mime-db/pull/82
>
> I missed it at first, but it was *closed*, but not *rejected*.
>
> <https://github.com/jshttp/mime-db/commit/5797174e5434a8d2978d9fdc13ec6a47ba20a02f>
> 2017-07-25T01:12:28Z
>> Add text/x-org
>> closes #82

Thank you for catching my oversight!!

I dug a little deeper and discovered that the popular NPM packages that
make use of jshttp/mime-db rank the source of each MIME type and discard
duplicates which have lower "preference".  For example, the
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.

https://github.com/jshttp/mime-types/blob/eca390b71004a70f4551197638c077cdba8cf954/index.js#L155

I think https://github.com/broofa/mime does something similar.

The result is that the two popular NPM utilities for getting a MIME type
from a file extension (see <https://www.npmjs.com/search?q=mime>) ignore
the ".org" -> "text/x-org" mapping in favor of ".org" ->
"application/vnd.lotus-organizer".

> So you can use text/x-org.
>
>> After I posted a comment on the thread, the maintainer responded:
>> 
>>> I would suggest opening a new PR.
>
> 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?

> Perhaps a worg page may be created to clarify current state of media
> type for org files. The question is what is the appropriate directory.

I agree that it would be good to track this information in one place so
we don't repeat ourselves ;)

Thanks,

Joseph

Reply via email to