aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-27 15:34:51 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-27 15:34:51 -0400
commitdf9f5b902a39d94c0da221b5d767b19e1c35e680 (patch)
tree5713162cd48e9ae8740c411ac319846c3d597089
parent48f33be848f027ec5a2a4aa8e2b270e8f7e2ff20 (diff)
downloadnextcloud-server-df9f5b902a39d94c0da221b5d767b19e1c35e680.tar.gz
nextcloud-server-df9f5b902a39d94c0da221b5d767b19e1c35e680.zip
Fix group detection for sharing in case username contains '@', fix for oc-1270
-rw-r--r--apps/files_sharing/ajax/getitem.php7
-rw-r--r--apps/files_sharing/lib_share.php2
2 files changed, 7 insertions, 2 deletions
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));
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 0237acfc1ac..3bedd9bebc8 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -179,7 +179,7 @@ class OC_Share {
$uid_shared_with = OC_Group::usersInGroup($uid_shared_with);
// Remove the owner from the list of users in the group
$uid_shared_with = array_diff($uid_shared_with, array(OCP\USER::getUser()));
- } else if ($uid = strstr($uid_shared_with, '@', true)) {
+ } else if ($uid = strrchr($uid_shared_with, '@', true)) {
$uid_shared_with = array($uid);
} else {
$uid_shared_with = array($uid_shared_with);