Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -1510,8 +1510,29 @@
}

if ($share->getShareType() === IShare::TYPE_CIRCLE) {
// TODO: have a sanity check like above?
return true;
if (
Server::get(IAppManager::class)->isEnabledForUser('circles')
&& class_exists('\OCA\Circles\Api\v1\Circles')
) {
$hasCircleId = (str_ends_with($share->getSharedWith(), ']'));
$shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0);
$shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' '));
if ($shareWithLength === false) {
$sharedWith = substr($share->getSharedWith(), $shareWithStart);
} else {
$sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
}
try {
$member = Circles::getMember($sharedWith, $this->userId, 1);

Check failure on line 1526 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedClass

apps/files_sharing/lib/Controller/ShareAPIController.php:1526:16: UndefinedClass: Class, interface or enum named OCA\Files_Sharing\Controller\Circles does not exist (see https://psalm.dev/019)
if ($member->getLevel() >= 1) {
return true;
}
return false;
} catch (\Exception $e) {
return false;
}
}
return false;
}

if ($share->getShareType() === IShare::TYPE_ROOM) {
Expand Down
1 change: 1 addition & 0 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@
<UndefinedClass>
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
</UndefinedClass>
<UndefinedDocblockClass>
<code><![CDATA[$this->getRoomShareHelper()]]></code>
Expand Down
Loading