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 <d.vedder@web.de>
This commit is contained in:
Daniel Vedder 2020-05-02 14:41:54 +02:00
parent 7193d2ffba
commit 0743a0b502

View file

@ -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