From df9f5b902a39d94c0da221b5d767b19e1c35e680 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 27 Jul 2012 15:34:51 -0400 Subject: Fix group detection for sharing in case username contains '@', fix for oc-1270 --- apps/files_sharing/ajax/getitem.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing/ajax') diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index ff6c29b6a0a..06a80102dec 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -22,8 +22,13 @@ while ($path != $userDirectory) { } } else { // Check if uid_shared_with is a group - if (($pos = strpos($uid_shared_with, '@')) !== false) { + $pos = strrpos($uid_shared_with, '@'); + if ($pos !== false) { $gid = substr($uid_shared_with, $pos + 1); + } else { + $gid = false; + } + if ($gid && OC_Group::groupExists($gid)) { // Include users in the group so the users can be removed from the list of people to share with if ($path == $source) { $group = array(array('gid' => $gid, 'permissions' => $rows[$i]['permissions'], 'users' => OC_Group::usersInGroup($gid), 'parentFolder' => false)); -- cgit v1.2.3