summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2017-06-21 18:04:32 +0200
committerBastien Nocera <hadess@hadess.net>2017-06-21 18:06:52 +0200
commit7b5308dab3b96f93fae6a676a545f02ee1e66fcf (patch)
treea84bc29f0d3bdf15204699962550eab56666cd85
parente74533f499971601e6b04f48b494f2795a8df5fe (diff)
downloadnautilus-sendto-7b5308dab3b96f93fae6a676a545f02ee1e66fcf.tar.gz
main: Fix crash when fast-content-type is unavailable
And try to read the content-type if the fast one isn't available. See https://bugzilla.redhat.com/show_bug.cgi?id=1353282
-rw-r--r--src/nautilus-sendto.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nautilus-sendto.c b/src/nautilus-sendto.c
index 5a5163a..52d2b89 100644
--- a/src/nautilus-sendto.c
+++ b/src/nautilus-sendto.c
@@ -491,7 +491,7 @@ nautilus_sendto_init (NautilusSendto *nst)
/* Get the mime-type, and whether the file is readable */
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","G_FILE_ATTRIBUTE_ACCESS_CAN_READ,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","G_FILE_ATTRIBUTE_ACCESS_CAN_READ,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
@@ -511,7 +511,15 @@ nautilus_sendto_init (NautilusSendto *nst)
} else {
g_debug ("No can-read attribute for '%s', assuming it is", filenames[i]);
}
+
mimetype = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ if (!mimetype)
+ mimetype = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (!mimetype) {
+ g_object_unref (info);
+ g_debug ("Could not get mime-type for '%s'", filenames[i]);
+ continue;
+ }
if (g_str_equal (mimetype, "inode/directory"))
nst->num_dirs++;