[evince/wip/hadess/mime-type-aliases: 1/2] libdocument: Fix handling of mime-type aliases



commit cac46b0e683e86990696b2bf3ac4aca46a5d3fcf
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 0347c2a5..ca1aeeb4 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]