summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-10-11 12:01:09 +0200
committerBastien Nocera <hadess@hadess.net>2019-10-11 12:01:09 +0200
commit4316e25258bfe45cad891e200721fe50d244da0d (patch)
tree48abdbb1d9d4d3ab7b5c28b2402c1219e7e2bbb5
parent65a6270229326ba898b6ec6335f42e52c46b54d8 (diff)
downloadgvfs-4316e25258bfe45cad891e200721fe50d244da0d.tar.gz
smb: 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/gvfsbackendsmb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index e6ffa5c4..b0bea3eb 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1442,6 +1442,7 @@ set_info_from_stat (GVfsBackendSmb *backend,
GIcon *icon = NULL;
GIcon *symbolic_icon = NULL;
char *content_type = NULL;
+ gboolean uncertain_content_type = FALSE;
if (S_ISDIR(statbuf->st_mode))
{
@@ -1459,7 +1460,7 @@ set_info_from_stat (GVfsBackendSmb *backend,
}
else if (basename != NULL)
{
- content_type = g_content_type_guess (basename, NULL, 0, NULL);
+ content_type = g_content_type_guess (basename, NULL, 0, &uncertain_content_type);
if (content_type)
{
icon = g_content_type_get_icon (content_type);
@@ -1469,7 +1470,12 @@ set_info_from_stat (GVfsBackendSmb *backend,
if (content_type)
{
- 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);
g_free (content_type);
}