Fix bug #3004, "claws picks wrong mime type for attachments"
authorColin Leroy <colin@colino.net>
Sun, 29 Sep 2013 09:02:56 +0000 (11:02 +0200)
committerColin Leroy <colin@colino.net>
Sun, 29 Sep 2013 09:02:56 +0000 (11:02 +0200)
Use first match for each extension

src/procmime.c

index 4951f3c..43208ed 100644 (file)
@@ -1150,12 +1150,11 @@ static GHashTable *procmime_get_mime_type_table(void)
 
                exts = g_strsplit(mime_type->extension, " ", 16);
                for (i = 0; exts[i] != NULL; i++) {
-                       /* use previously dup'd key on overwriting */
-                       if (g_hash_table_lookup(table, exts[i]))
-                               key = exts[i];
-                       else
+                       /* Don't overwrite previously inserted extension */
+                       if (!g_hash_table_lookup(table, exts[i])) {
                                key = g_strdup(exts[i]);
-                       g_hash_table_insert(table, key, mime_type);
+                               g_hash_table_insert(table, key, mime_type);
+                       }
                }
                g_strfreev(exts);
        }