diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-10-11 12:00:23 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2019-10-11 12:00:23 +0200 |
commit | 606ae725c7aad8434ce89a0f5dfefe8dc5a4248c (patch) | |
tree | 81a68d05e515734a45f5d76ff3f08f90892f6fa4 | |
parent | 516f3a744c20cfc84161d1cf9b7a965cf432e94e (diff) | |
download | gvfs-606ae725c7aad8434ce89a0f5dfefe8dc5a4248c.tar.gz |
mtp: 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/gvfsbackendmtp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c index fe26b8b5..7777c66b 100644 --- a/daemon/gvfsbackendmtp.c +++ b/daemon/gvfsbackendmtp.c @@ -1236,6 +1236,7 @@ get_file_info (GVfsBackend *backend, GIcon *icon = NULL; GIcon *symbolic_icon = NULL; char *content_type = NULL; + gboolean uncertain_content_type = FALSE; char *mount_id = NULL; char *file_id = NULL; @@ -1260,11 +1261,12 @@ get_file_info (GVfsBackend *backend, default: g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, FALSE); g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR); - content_type = g_content_type_guess (file->filename, NULL, 0, NULL); + content_type = g_content_type_guess (file->filename, NULL, 0, &uncertain_content_type); break; } - g_file_info_set_content_type (info, content_type); + if (!uncertain_content_type) + g_file_info_set_content_type (info, content_type); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type); |