apibase: check share readable

cap
Varun Patil 2022-12-02 20:12:21 -08:00
parent 1a9d229b95
commit 6db1752359
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ class ApiBase extends Controller
// Public shared folder // Public shared folder
if ($token = $this->getShareToken()) { if ($token = $this->getShareToken()) {
$share = $this->shareManager->getShareByToken($token)->getNode(); // throws exception if not found $share = $this->shareManager->getShareByToken($token)->getNode(); // throws exception if not found
if (!$share instanceof Folder) { if (!$share instanceof Folder || !$share->isReadable() || !$share->isShareable()) {
throw new \Exception('Share not found or invalid'); throw new \Exception('Share not found or invalid');
} }
@ -207,7 +207,7 @@ class ApiBase extends Controller
try { try {
$share = $this->shareManager->getShareByToken($token)->getNode(); // throws exception if not found $share = $this->shareManager->getShareByToken($token)->getNode(); // throws exception if not found
if (!$share instanceof Folder) { if (!$share instanceof Folder || !$share->isReadable() || !$share->isShareable()) {
return null; return null;
} }
} catch (\Exception $e) { } catch (\Exception $e) {