[nautilus/wip/oholy/fast-content-type] file: Fallback to fast-content-type if content-type is not set



commit 45e607b18c0221d3a703f9c93ee9915ba9cbadc6
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Mar 31 15:55:56 2020 +0200

    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

 src/nautilus-file.c | 4 ++++
 1 file changed, 4 insertions(+)
---
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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]