From 9991fb1762bd44762c4ee43b2484f30114a307d4 Mon Sep 17 00:00:00 2001 From: Max Eliaser Date: Sun, 30 Dec 2018 14:20:02 -0800 Subject: [libcaja-private] Re-check file MIME type before picking an application. An example of when the MIME type might change: a file is initially created with 0 bytes of content, but more data is added later. Empty files are always detected as plain text, but the file might not be empty anymore when the user opens it. This commit affects the behavior when double-clicking a file and when right- clicking on it too. --- src/file-manager/fm-directory-view.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index dcf96b2a..7105036a 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -8813,6 +8813,13 @@ real_update_menus (FMDirectoryView *view) file = CAJA_FILE (l->data); + /* Double-check if the files' MIME types have changed before we + commit to a choice of applications for them. This can happen + if, for instance, a file was originally created with 0 bytes + and then content was added to it later-- it will change from + plaintext to something else. */ + caja_file_refresh_info (file); + if (!caja_mime_file_opens_in_external_app (file)) { show_app = FALSE; } -- cgit v1.2.1