diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-10-11 12:01:25 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2019-10-11 12:01:25 +0200 |
commit | e3dee379d6b32e914dbf49f8f71b6b8af13d2841 (patch) | |
tree | b2f419c4af6f83a7b4bb4cec37ef3683c27acf2d | |
parent | 4316e25258bfe45cad891e200721fe50d244da0d (diff) | |
download | gvfs-e3dee379d6b32e914dbf49f8f71b6b8af13d2841.tar.gz |
daemon: Don't set a content-type that isn't certain
Don't ignore the result_uncertain flag from g_content_type_guess() as it
might cause nautilus to incorrectly think that a particular file is of a
certain type, and never check its magic.
-rw-r--r-- | daemon/gvfsdaemonutils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c index 47fe042c..5292ba4a 100644 --- a/daemon/gvfsdaemonutils.c +++ b/daemon/gvfsdaemonutils.c @@ -163,6 +163,7 @@ gvfs_file_info_populate_content_types (GFileInfo *info, { char *free_mimetype = NULL; const char *mimetype; + gboolean uncertain_content_type = FALSE; GIcon *icon; GIcon *symbolic_icon; @@ -189,7 +190,7 @@ gvfs_file_info_populate_content_types (GFileInfo *info, mimetype = "inode/mountable"; break; case G_FILE_TYPE_REGULAR: - free_mimetype = g_content_type_guess (basename, NULL, 0, NULL); + free_mimetype = g_content_type_guess (basename, NULL, 0, &uncertain_content_type); mimetype = free_mimetype; break; case G_FILE_TYPE_UNKNOWN: @@ -198,7 +199,8 @@ gvfs_file_info_populate_content_types (GFileInfo *info, break; } - g_file_info_set_content_type (info, mimetype); + if (!uncertain_content_type) + g_file_info_set_content_type (info, mimetype); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, mimetype); icon = g_content_type_get_icon (mimetype); |