[evince/gnome-3-28] libdocument: Fix handling of mime-type aliases



commit 57f457361b8902bcf94e2e47430471f67af6004b
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 4 10:32:36 2018 +0200

    libdocument: Fix handling of mime-type aliases
    
    We can't use string equality to find matching mime-types, as this
    doesn't handle mime-type aliases. For example, the application/x-cbr
    mime-type became an alias to the IANA registered
    application/vnd.comicbook-rar mime-type.
    
    We need to check mime-type equivalence using
    g_content_type_is_mime_type() instead of a string comparison to handle
    versions of shared-mime-info where application/x-cbr is an alias.
    
    Closes: #972

 libdocument/ev-document-factory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c
index aef17690..3fd4de19 100644
--- a/libdocument/ev-document-factory.c
+++ b/libdocument/ev-document-factory.c
@@ -58,7 +58,7 @@ get_backend_info_for_mime_type (const gchar *mime_type)
                 guint i;
 
                 for (i = 0; mime_types[i] != NULL; ++i) {
-                        if (g_ascii_strcasecmp (mime_type, mime_types[i]) == 0)
+                        if (g_content_type_is_mime_type (mime_type, mime_types[i]))
                                 return info;
                 }
         }


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