Skip to content

Commit 4972647

Browse files
committed
Catch exception
1 parent 426a12b commit 4972647

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

lib/private/share20/manager.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,12 @@ protected function userCreateChecks(\OCP\Share\IShare $share) {
322322
$existingShares = $provider->getSharesByPath($share->getNode());
323323
foreach($existingShares as $existingShare) {
324324
// Ignore if it is the same share
325-
if ($existingShare->getFullId() === $share->getFullId()) {
326-
continue;
325+
try {
326+
if ($existingShare->getFullId() === $share->getFullId()) {
327+
continue;
328+
}
329+
} catch (\UnexpectedValueException $e) {
330+
//Shares are not identical
327331
}
328332

329333
// Identical share already existst
@@ -569,7 +573,11 @@ public function updateShare(\OCP\Share\IShare $share) {
569573
throw new \Exception('The Share API is disabled');
570574
}
571575

572-
$originalShare = $this->getShareById($share->getFullId());
576+
try {
577+
$originalShare = $this->getShareById($share->getFullId());
578+
} catch (\UnexpectedValueException $e) {
579+
throw new \InvalidArgumentException('Share does not have a full id');
580+
}
573581

574582
// We can't change the share type!
575583
if ($share->getShareType() !== $originalShare->getShareType()) {
@@ -674,10 +682,15 @@ protected function deleteChildren(\OCP\Share\IShare $share) {
674682
*
675683
* @param \OCP\Share\IShare $share
676684
* @throws ShareNotFound
685+
* @throws \InvalidArgumentException
677686
*/
678687
public function deleteShare(\OCP\Share\IShare $share) {
679688
// Just to make sure we have all the info
680-
$share = $this->getShareById($share->getFullId());
689+
try {
690+
$share = $this->getShareById($share->getFullId());
691+
} catch (\UnexpectedValueException $e) {
692+
throw new \InvalidArgumentException('Share does not have a full id');
693+
}
681694

682695
$formatHookParams = function(\OCP\Share\IShare $share) {
683696
// Prepare hook

0 commit comments

Comments
 (0)