[nautilus/wip/antoniof/local_vs_native_fixup: 153/157] directory: Ignore trash://* in is_local_or_fuse()




commit c0d79c83099811ee5df5991a40c0d32cc260a236
Author: António Fernandes <antoniof gnome org>
Date:   Sat May 16 20:39:28 2020 +0100

    directory: Ignore trash://* in is_local_or_fuse()
    
    We use the is_local_or_fuse() method in 2 cases where we want to know
    whether a local path can be obtained for a file in a give location:
    
        1) when determining which apps can open the file, as some apps
           don't understand URIs;
        2) when providing local paths to scripts from the Scripts menu.
    
    It has been returning TRUE for files in the Trash as a special case,
    because they are stored in a real location which can be obtained from
    the value of the G_FILE_ATTRIBUTE_STANDARD_TARGET_URI attribute.
    
    However, we have been ignoring this attribute for trashed files since
    commit bc22321e5b5b02711b65d8c1b0301a53de42f18b.
    
    This has resulted in two bugs:
    
        1) we pick the default handler to open an application ignoring the
           fact that it may not be able to open URIs;
        2) we pass relative paths as command-line parameters for scripts,
           which they wrongly interpret as being relative to $HOME because
           we can't chdir() into trash:///.
    
    As discussed in https://bugzilla.gnome.org/show_bug.cgi?id=768168, we
    probably don't want to provide direct access to the real location of
    trashed files.
    
    So, let's drop this special case, making is_local_or_fuse() return
    FALSE for trash://*, which fixes these two bugs.

 src/nautilus-directory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 499042e02..d9a91904e 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -791,8 +791,7 @@ nautilus_directory_is_local_or_fuse (NautilusDirectory *directory)
      */
     path = g_file_get_path (directory->details->location);
 
-    return nautilus_directory_is_in_trash (directory) ||
-           nautilus_directory_is_in_recent (directory) ||
+    return nautilus_directory_is_in_recent (directory) ||
            g_file_is_native (directory->details->location) ||
            path != NULL;
 }


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