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



commit e64a4cb4f5529240d292a80903de2c85dd45ff95
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Oct 11 11:57:49 2019 +0200

    afp: 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/gvfsafpserver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index d1787a47..a8eeb824 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -1608,10 +1608,12 @@ g_vfs_afp_server_fill_info (GVfsAfpServer *server,
     if (!directory)
     {
       char *content_type;
+      gboolean uncertain_content_type;
       GIcon *icon;
 
-      content_type = g_content_type_guess (utf8_name, NULL, 0, NULL);
-      g_file_info_set_content_type (info, content_type);
+      content_type = g_content_type_guess (utf8_name, NULL, 0, &uncertain_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]