summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <[email protected]>2020-03-31 15:55:56 +0200
committerColomban Wendling <[email protected]>2025-07-22 11:11:01 +0200
commit16145e6d4e86f0c6fc58a0e3ceec6ba16a84d900 (patch)
treee45c4a6baf3b68f827e2155be6330b5722cb84ea
parentd6f4c970f9aec18aefad196cf24c5d432cd5bec8 (diff)
downloadcaja-fast-content-type.tar.bz2
caja-fast-content-type.tar.xz
file: Fallback to fast-content-type if content-type is not setfast-content-type
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.
-rw-r--r--libcaja-private/caja-file.c3
1 files changed, 3 insertions, 0 deletions
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);