]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix group detection for sharing in case username contains '@', fix for oc-1270
authorMichael Gapczynski <mtgap@owncloud.com>
Fri, 27 Jul 2012 19:34:51 +0000 (15:34 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Mon, 30 Jul 2012 14:07:19 +0000 (10:07 -0400)
apps/files_sharing/ajax/getitem.php
apps/files_sharing/lib_share.php

index 36ac372cad44de36f695a702055b292889efe7ec..852e5a245718b02ed9870729f05e17d0361a92ef 100644 (file)
@@ -23,8 +23,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));
index c0d0a1f18b95c0b1991c7baf9b64d8923a2df9f9..b939132a9a0f0ccbb3ed0298b45138d7b2b4985b 100644 (file)
@@ -182,7 +182,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);