[Pkg-owncloud-commits] [owncloud-client] 16/218: don't show share menu item for top level folders

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 5414c6544271a53ba05c6075809e41f2e2eb0fc5
Author: Individual IT Services <info at individual-it.net>
Date:   Fri Aug 28 16:24:52 2015 +0545

    don't show share menu item for top level folders
    
    Top level folders cannot be shared. If you try you receive an 403 error.
    So we should not show the "Share with Owncloud" menu item for them
---
 shell_integration/nautilus/syncstate.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/shell_integration/nautilus/syncstate.py b/shell_integration/nautilus/syncstate.py
index b44e4c4..1ff5bdd 100755
--- a/shell_integration/nautilus/syncstate.py
+++ b/shell_integration/nautilus/syncstate.py
@@ -157,13 +157,18 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
         # internal or external file?!
         syncedFile = False
         for reg_path in socketConnect.registered_paths:
+            topLevelFolder=False
             filename = get_local_path(file.get_uri())
             #check if its a folder (ends with an /), if yes add a "/" otherwise it will not find the entry in the table
             if os.path.isdir(filename+"/"):
                 filename=filename+"/"
+                #check if toplevel folder, we need to ignore those as they cannot be shared
+                if filename.count("/") < (reg_path.count("/")+2):
+                    topLevelFolder=True                
             # only show the menu extension if the file is synced and the sync
             # status is ok. Not for ignored files etc.
-            if filename.startswith(reg_path) and socketConnect.nautilusVFSFile_table[filename]['state'] == 'OK':
+            # ignore top level folders
+            if filename.startswith(reg_path) and topLevelFolder == False and socketConnect.nautilusVFSFile_table[filename]['state'] == 'OK':
                 syncedFile = True
 
         # if it is neither in a synced folder or is a directory

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list