summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-10-11 12:00:09 +0200
committerBastien Nocera <hadess@hadess.net>2019-10-11 12:00:09 +0200
commit516f3a744c20cfc84161d1cf9b7a965cf432e94e (patch)
treedccee96f9d561ba46c95b2331e0630d5df576b15 /daemon
parent1eb3b298af912eb052c3edbc1890e00ca198ec2e (diff)
downloadgvfs-516f3a744c20cfc84161d1cf9b7a965cf432e94e.tar.gz
gphoto2: 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.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsbackendgphoto2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index ae59691e..3120b389 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -808,6 +808,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
char *full_path;
GFileInfo *cached_info;
char *mime_type;
+ gboolean uncertain_content_type;
GIcon *icon;
unsigned int n;
@@ -959,6 +960,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
* libgphoto2 API :-/
*/
mime_type = NULL;
+ uncertain_content_type = FALSE;
if (gp_info.file.fields & GP_FILE_INFO_TYPE)
{
/* application/x-unknown is a bogus mime type return by some
@@ -970,10 +972,11 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
}
}
if (mime_type == NULL)
- mime_type = g_content_type_guess (name, NULL, 0, NULL);
+ mime_type = g_content_type_guess (name, NULL, 0, &uncertain_content_type);
if (mime_type == NULL)
mime_type = g_strdup ("application/octet-stream");
- g_file_info_set_content_type (info, mime_type);
+ if (!uncertain_content_type)
+ g_file_info_set_content_type (info, mime_type);
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, mime_type);
/* we offer thumbnails for both pics and video (see bgo #585853) */