From 0743a0b502154caa4ceebf9f7acb7b78f6174705 Mon Sep 17 00:00:00 2001 From: Daniel Vedder Date: Sat, 2 May 2020 14:41:54 +0200 Subject: [PATCH] Resolve symlinks when checking for registered paths. Fixes issue #1948: https://github.com/nextcloud/desktop/issues/1948 The client already resolves symlinks when adding new paths to the sync-list, but the Nautilus plugin did not do this yet, causing it to not recognise synced folders if they were accessed via a symlink. Signed-off-by: Daniel Vedder --- shell_integration/nautilus/syncstate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py index 84a13161c..c90c20aa4 100644 --- a/shell_integration/nautilus/syncstate.py +++ b/shell_integration/nautilus/syncstate.py @@ -191,11 +191,12 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider): def check_registered_paths(self, filename): topLevelFolder = False internalFile = False + absfilename = os.path.realpath(filename) for reg_path in socketConnect.registered_paths: - if filename == reg_path: + if absfilename == reg_path: topLevelFolder = True break - if filename.startswith(reg_path): + if absfilename.startswith(reg_path): internalFile = True # you can't have a registered path below another so it is save to break here break @@ -447,6 +448,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.InfoProvider): return filename = get_local_path(item.get_uri()) + filename = os.path.realpath(filename) if item.is_directory(): filename += os.sep