From 16145e6d4e86f0c6fc58a0e3ceec6ba16a84d900 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Tue, 31 Mar 2020 15:55:56 +0200 Subject: 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, Caja 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. Imported from Nautilus commit: https://gitlab.gnome.org/GNOME/nautilus/-/commit/0e5978035b0fc87c91d7b93ed79c64d51b6d6825 Fixes #1840. --- libcaja-private/caja-file.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libcaja-private/caja-file.c') diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index faa7bb50..faea7993 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -2460,6 +2460,9 @@ update_info_internal (CajaFile *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 (eel_strcmp (file->details->mime_type, mime_type) != 0) { changed = TRUE; g_clear_pointer (&file->details->mime_type, g_ref_string_release); -- cgit v1.2.1