[Pkg-owncloud-commits] [owncloud-client] 112/171: OS X shell: Don't allow sharing sync roots #3505

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:57 UTC 2016


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

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit 439eddb5234e132eba311361841bd1125c794d1b
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Jan 14 16:24:29 2016 +0100

    OS X shell: Don't allow sharing sync roots #3505
---
 .../OwnCloudFinderSync/FinderSyncExt/FinderSync.h    |  1 -
 .../OwnCloudFinderSync/FinderSyncExt/FinderSync.m    | 20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.h b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.h
index 749f849..a135604 100644
--- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.h
+++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.h
@@ -21,7 +21,6 @@
 {
 	SyncClientProxy *_syncClientProxy;
 	NSMutableSet *_registeredDirectories;
-	NSMutableSet *_requestedUrls;
 	NSString *_shareMenuTitle;
 }
 
diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
index 6273b50..440af7e 100644
--- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
+++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m
@@ -83,7 +83,25 @@
 
 - (NSMenu *)menuForMenuKind:(FIMenuKind)whichMenu
 {
-	if (_shareMenuTitle) {
+	FIFinderSyncController *syncController = [FIFinderSyncController defaultController];
+	NSMutableSet *rootPaths = [[NSMutableSet alloc] init];
+	[syncController.directoryURLs enumerateObjectsUsingBlock: ^(id obj, BOOL *stop) {
+		[rootPaths addObject:[obj path]];
+	}];
+
+	// The server doesn't support sharing a root directory so do not show the option in this case.
+	// It is still possible to get a problematic sharing by selecting both the root and a child,
+	// but this is so complicated to do and meaningless that it's not worth putting this check
+	// also in shareMenuAction.
+	__block BOOL onlyRootsSelected = YES;
+	[syncController.selectedItemURLs enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop) {
+		if (![rootPaths member:[obj path]]) {
+			onlyRootsSelected = NO;
+			*stop = YES;
+		}
+	}];
+
+	if (_shareMenuTitle && !onlyRootsSelected) {
 		NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
 		[menu addItemWithTitle:_shareMenuTitle action:@selector(shareMenuAction:) keyEquivalent:@"title"];
 		

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