diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c index 793000275..1acbd776f 100644 --- a/gio/tests/contenttype.c +++ b/gio/tests/contenttype.c @@ -324,11 +324,27 @@ test_tree (void) } } +static void +test_type_is_a_special_case (void) +{ + gboolean res; + + g_test_bug ("782311"); + + /* Everything but the inode type is application/octet-stream */ + res = g_content_type_is_a ("inode/directory", "application/octet-stream"); + g_assert_false (res); + res = g_content_type_is_a ("anything", "application/octet-stream"); + g_assert_true (res); +} + int main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); + g_test_bug_base ("http://bugzilla.gnome.org/"); + g_test_add_func ("/contenttype/guess", test_guess); g_test_add_func ("/contenttype/unknown", test_unknown); g_test_add_func ("/contenttype/subtype", test_subtype); @@ -338,6 +354,8 @@ main (int argc, char *argv[]) g_test_add_func ("/contenttype/icon", test_icon); g_test_add_func ("/contenttype/symbolic-icon", test_symbolic_icon); g_test_add_func ("/contenttype/tree", test_tree); + g_test_add_func ("/contenttype/test_type_is_a_special_case", + test_type_is_a_special_case); return g_test_run (); } diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c index 42dda5803..9ba224a9e 100644 --- a/gio/xdgmime/xdgmime.c +++ b/gio/xdgmime/xdgmime.c @@ -791,7 +791,8 @@ _xdg_mime_mime_type_subclass (const char *mime, strncmp (umime, "text/", 5) == 0) return 1; - if (strcmp (ubase, "application/octet-stream") == 0) + if (strcmp (ubase, "application/octet-stream") == 0 && + strncmp (umime, "inode/", 6) != 0) return 1; parents = _xdg_mime_parent_list_lookup (parent_list, umime); diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c index 9ea32c834..e2d49ed22 100644 --- a/gio/xdgmime/xdgmimecache.c +++ b/gio/xdgmime/xdgmimecache.c @@ -925,7 +925,8 @@ _xdg_mime_cache_mime_type_subclass (const char *mime, strncmp (umime, "text/", 5) == 0) return 1; - if (strcmp (ubase, "application/octet-stream") == 0) + if (strcmp (ubase, "application/octet-stream") == 0 && + strncmp (umime, "inode/", 6) != 0) return 1; for (i = 0; _caches[i]; i++)