summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-03-31 13:55:56 +0000
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2020-04-05 12:20:33 +0000
commit7c4750b745e12ea6a2e5d9b875688e78ce50e092 (patch)
treeb07e83f25059de9ca451924c8ce54d251905ff16
parentad20a85a8df72f587a6e9ce5f0825b6bf5eda1bc (diff)
downloadnautilus-7c4750b745e12ea6a2e5d9b875688e78ce50e092.tar.gz
file: Fallback to fast-content-type if content-type is not set
The G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE attribute doesn't have to be always set. See https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/68 for more details. In that case, Nautilus fallbacks to the "application/octet-stream" type, which causes issues when opening the files. Let's fallback to the "standard::fast-content-type" attribute instead to fix issues when opening such files. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1425 (cherry picked from commit 0e5978035b0fc87c91d7b93ed79c64d51b6d6825)
-rw-r--r--src/nautilus-file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 45603af08..a4a7e1b21 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -2823,6 +2823,10 @@ update_info_internal (NautilusFile *file,
}
mime_type = g_file_info_get_content_type (info);
+ if (mime_type == NULL)
+ {
+ mime_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ }
if (g_strcmp0 (file->details->mime_type, mime_type) != 0)
{
changed = TRUE;