summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2020-05-16 20:39:28 +0100
committerOndrej Holy <oholy@redhat.com>2021-01-25 10:54:11 +0000
commit504fd9e0037e6fc4c6e13ef858b72e32ce5f11ce (patch)
tree5fbc073d8e8eb6acdadff10886afe51be2b374d8
parent8bc93539cb3899b7fed08370c32cc802f5b59c7b (diff)
downloadnautilus-504fd9e0037e6fc4c6e13ef858b72e32ce5f11ce.tar.gz
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.
-rw-r--r--src/nautilus-directory.c3
1 files changed, 1 insertions, 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;
}