[gvfs/wip/hadess/fast-content-type: 3/10] afc: Don't set a content-type that isn't certain
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/hadess/fast-content-type: 3/10] afc: Don't set a content-type that isn't certain
- Date: Fri, 11 Oct 2019 10:04:08 +0000 (UTC)
commit fc963513df3946f22632f8df43baf94fed79a13e
Author: Bastien Nocera <hadess hadess net>
Date: Fri Oct 11 11:59:40 2019 +0200
afc: 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/gvfsbackendafc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index ce68aa45..d51b21e6 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -1593,6 +1593,7 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
GIcon *icon = NULL;
GIcon *symbolic_icon = NULL;
gchar *content_type = NULL;
+ gboolean uncertain_content_type = FALSE;
char *display_name;
char *linktarget = NULL;
char **afctargetinfo = NULL;
@@ -1675,11 +1676,12 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
}
if (content_type == 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)
{
- 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]