summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-10-01 09:34:44 +0200
committerraveit65 <[email protected]>2019-12-01 18:47:11 +0100
commitf921dfca5336de497f2c95e7e0ba9d625e041c10 (patch)
tree42321714728389f127ceaea408308dfa6ccd9965 /src
parent4f66aef00bb86ca01616849bfc60ef362fbd6f69 (diff)
downloadengrampa-f921dfca5336de497f2c95e7e0ba9d625e041c10.tar.bz2
engrampa-f921dfca5336de497f2c95e7e0ba9d625e041c10.tar.xz
Check if a mime-type is an alias in compute_supported_archive_types
For instance, application/x-lha is an alias of application/x-lzh-compressed, mime_type_desc.mime_type should only store non duplicated primary mime-types, to avoid duplicates in the warehouse.
Diffstat (limited to 'src')
-rw-r--r--src/fr-init.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fr-init.c b/src/fr-init.c
index 5f4f3a8..e09f463 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -501,6 +501,17 @@ get_archive_filename_extension (const char *filename)
return NULL;
}
+static gboolean
+is_mime_type_alias (const char *mime_type)
+{
+ size_t i;
+
+ for (i = 0; mime_type_desc[i].mime_type != NULL; i++)
+ if (g_content_type_equals (mime_type_desc[i].mime_type, mime_type))
+ return TRUE;
+
+ return FALSE;
+}
int
get_mime_type_index (const char *mime_type)
@@ -596,7 +607,9 @@ compute_supported_archive_types (void)
cap = g_ptr_array_index (reg_com->caps, j);
idx = get_mime_type_index (cap->mime_type);
if (idx < 0) {
- g_warning ("mime type not recognized: %s", cap->mime_type);
+ if (!is_mime_type_alias (cap->mime_type)) {
+ g_warning ("mime type not recognized: %s", cap->mime_type);
+ }
continue;
}
mime_type_desc[idx].capabilities |= cap->current_capabilities;