[PATCH] Improve xdgmime sniffing behavior



I've already committed the attached patch to the xdgmime repository. May
I commit it to gnome-vfs as well? It fixes bug 331719 [1], which
contains some more information on why this is an issue.

It might cause trouble (i.e. unknown MIME types) with files where the
same extension and contents patterns with the same priority match for
the same file, but two unrelated MIME types, but that really sounds like
a very, very rare case.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=331719

-- 
Christian Neumair <chris gnome-de org>
Index: src/xdgmimemagic.c
===================================================================
RCS file: /cvs/mime/xdgmime/src/xdgmimemagic.c,v
retrieving revision 1.18
diff -u -p -r1.18 xdgmimemagic.c
--- src/xdgmimemagic.c	3 Jan 2006 13:05:44 -0000	1.18
+++ src/xdgmimemagic.c	19 Feb 2006 12:36:00 -0000
@@ -671,6 +671,10 @@ _xdg_mime_magic_lookup_data (XdgMimeMagi
 	  if ((mime_type == NULL) || (xdg_mime_mime_type_subclass (match->mime_type, mime_type)) || match->priority > priority) {
 	    mime_type = match->mime_type;
 	    priority = match->priority;
+	  } else if (match->priority == priority) {
+	    /* multiple unrelated patterns with the same priority matched,
+	     * so we can't tell what type this is. */
+	    mime_type = NULL;
 	  }
 	}
       else 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]