]> source.dussan.org Git - nextcloud-server.git/commitdiff
circleId too short in some request 24196/head
authorMaxence Lange <maxence@artificial-owl.com>
Fri, 13 Nov 2020 09:58:54 +0000 (08:58 -0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 18 Nov 2020 07:57:22 +0000 (07:57 +0000)
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
apps/files_sharing/lib/Controller/ShareAPIController.php

index 2c2ec393d3f2b53b4d57408decb5bec20e1bb3f2..aaca16b32e6cedcd40ed4e3df04615e308f54a2c 100644 (file)
@@ -1648,10 +1648,11 @@ class ShareAPIController extends OCSController {
                        $hasCircleId = (substr($share->getSharedWith(), -1) === ']');
                        $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0);
                        $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' '));
-                       if (is_bool($shareWithLength)) {
-                               $shareWithLength = -1;
+                       if ($shareWithLength === false) {
+                               $sharedWith = substr($share->getSharedWith(), $shareWithStart);
+                       } else {
+                               $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
                        }
-                       $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
                        try {
                                $member = \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1);
                                if ($member->getLevel() >= 4) {