diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 1e121d8c868..1390eedf26e 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -207,8 +207,16 @@ class ShareAPIController extends OCSController { $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'EMAIL'); $result['token'] = $share->getToken(); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { - $result['share_with_displayname'] = $share->getSharedWith(); - $result['share_with'] = explode(' ', $share->getSharedWith(), 2)[0]; + // getSharedWith() returns either "name (type, owner)" or + // "name (type, owner) [id]", depending on the Circles app version. + $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); + + $displayNameLength = ($hasCircleId? strrpos($share->getSharedWith(), ' '): strlen($share->getSharedWith())); + $result['share_with_displayname'] = substr($share->getSharedWith(), 0, $displayNameLength); + + $shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0); + $shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' ')); + $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); } |