[gvfs/wip/hadess/fast-content-type: 6/10] mtp: Don't set a content-type that isn't certain



commit 606ae725c7aad8434ce89a0f5dfefe8dc5a4248c
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Oct 11 12:00:23 2019 +0200

    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.

 daemon/gvfsbackendmtp.c | 6 ++++--
 1 file 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]