[gdk-pixbuf] Improve mime type detection



commit 902688a2be99baea02067a657ac19ffb884f41c6
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 19 00:29:36 2013 -0500

    Improve mime type detection
    
    The mime database has no magic at all for xbm, and it
    gets sniffed as text/plain. This is a regression from
    when we were using our own magic, so be a little more
    forgiving here - treat a mimetype of 'text/plain' like
    uncertain results, and consult the filename. This lets
    us at least recognize files with the extension .xbm
    correctly again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=573726

 gdk-pixbuf/gdk-pixbuf-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 0cb6ed3..bbd71dd 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -883,7 +883,7 @@ _gdk_pixbuf_get_module (guchar *buffer, guint size,
         gboolean uncertain;
 
         mime_type = g_content_type_guess (NULL, buffer, size, &uncertain);
-        if (uncertain && filename != NULL) {
+        if ((uncertain || g_str_equal (mime_type, "text/plain")) && filename != NULL) {
                 g_free (mime_type);
                 mime_type = g_content_type_guess (filename, buffer, size, NULL);
         }


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