Shared-mime checking order

David Faure dfaure at trolltech.com
Mon Sep 17 13:03:00 PDT 2007


On Friday 24 August 2007, Alexander Larsson wrote:
> On Fri, 2007-08-24 at 16:11 +0200, David Faure wrote:
> 
> > We could do the same with *.pdf which could be application/pdf or 
> > application/pdf+gz : sniffing would tell us if it's pdf or gzip...
> > 
> > Hmm and what I described as "unlikely" above is what happens for *.ogg files, 
> > if we make their magic low-prio again. The above spec addition would allow to 
> > do ogg-related magic only on *.ogg files, not on every file.
> 
> Hmm. Aren't these two different cases?
> 
> One case is:
>  extension matches: text/plain, application/msword
>  sniffed type: application/x-ole-storage
> 
> One of the matched extensions is a subclass of the sniffed type, so we
> pick that one. (i.e. application/msword inherits from
> application/x-ole-storage)

Right. Well it doesn't seem to inherit from it right now, so this bug should be fixed, see attachment.

> The other case is:
>  extension mapped: all the *.ogg types
>  sniffed type: a specific ogg type
> 
> Here the sniffed type is equal to one of the the matched extension
> types, so we pick that one.
I see.

Interesting, I hadn't noticed that freedesktop.xml already comes with "conflicting extensions",
i.e. multiple mimetypes associated to the same extension. Which proves that we -have- to
define rules for how to handle this in any case :)

> Both of these rules makes sense to me, and should be applied when there
> is a conflict. 
Agreed.

> We should also make sure that we add all possible conflicting extension
> matches to the database. For instace, if we add "*.pdf" to
> application/x-gzpdf then we could use sniffing to resolve which one it
> is. 

I agree. My unit test for the *.doc conflict-resolving shows that "*.doc" should
be added to the glob patterns for text/plain, for instance.
Do you have access for making changes to the specification and to the shared-mime database, btw? (I don't)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msword-inheritance.diff
Type: text/x-diff
Size: 560 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xdg/attachments/20070917/dcf7e414/attachment.diff 


More information about the xdg mailing list