MIME info spec: Handling containers/multiple MIME types per glob pattern
shaunm at gnome.org
Tue Nov 15 12:52:52 PST 2005
On Tue, 2005-11-15 at 21:12 +0100, Christian Neumair wrote:
> On Di, 2005-11-15 at 14:48 -0500, Rodney Dawes wrote:
> > On Tue, 2005-11-15 at 19:53 +0100, Christian Neumair wrote:
> > > We'll run into the following issue in the long term:
> > > There is an n:1 mapping between MIME types, and glob patterns, i.e.
> > > "text/x-patch" has "*.diff" and "*.patch", but the "*.ogg" pattern
> > > cannot have multiple MIME types associated.
> > > Since we have a few container formats like Windows Media or Ogg, there
> > > is no way of telling xdgmime clients that multiple applications match a
> > > matched pattern, i.e. that a "*.ogg" file can be an Ogg Theora, or an
> > > Ogg Vorbis stream, thus requiring the application to do MIME sniffing
> > > before being able what MIME type the file actually is.
> > In the OGG case, MIME sniffing won't help at all. There is an RFC for
> > the application/ogg MIME type, and by definition, all OGG files should
> > be that type, regardless of content. To fix the issue, we are going to
> > have to come up with something that either goes beyond the MIME type
> > itself, and checks other file data,
>  proposes to introduce application/x-foo MIME types for the various
> contents, and use application/ogg as a their parent, thus using
> application/ogg as container type, but - if there was an API for
> determining whether multiple patterns are associated with a particular
> file name - informing that further investigation (sniffing) is required
> for determining the contents type. One of the x-foo types will match, et
> voila, we got the type.
> Also note that the pattern "*.pot" matches gettext templates and PPT
> presentations. The MIME type can also only be determined sniffing the
>  https://bugs.freedesktop.org/show_bug.cgi?id=1002
For some extra data points, one user is complaining that he
can't get MatLab file types recognized properly:
As an added bonus, Maple, MatLab, and Mathematica have all
used the .m extension on files at some point. It's also
the extension used for Objective-C source files (and that's
what xdgmime currently recognizes them as).
As for Ogg having only one official MIME type, I don't think
we should let crappy RFCs stop us from making usable software.
If we have to invent application/x-ogg-theora, then let's do
that. (Or, hey, steal those fancy UTIs from Apple...yummy.)
I think we need to be able to AND together globs and magic
matches to get most of these cases right. But then there
are definitely performance considerations if you *have* to
do sniffing every time, especially for remote folders.
More information about the xdg