diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-08 21:08:03 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-09 11:05:34 +0100 |
commit | 49726470abe14b23543dab0d5ba5af939d1f7634 (patch) | |
tree | 9e21a06bbc37887bda32aed07055fa32aef8d41c | |
parent | 426a12baaa6f30aee081358f61108218e11c9e07 (diff) | |
download | nextcloud-server-49726470abe14b23543dab0d5ba5af939d1f7634.tar.gz nextcloud-server-49726470abe14b23543dab0d5ba5af939d1f7634.zip |
Catch exception
-rw-r--r-- | lib/private/share20/manager.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index ddf1fa57c54..5d37921a1de 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -322,8 +322,12 @@ class Manager implements IManager { $existingShares = $provider->getSharesByPath($share->getNode()); foreach($existingShares as $existingShare) { // Ignore if it is the same share - if ($existingShare->getFullId() === $share->getFullId()) { - continue; + try { + if ($existingShare->getFullId() === $share->getFullId()) { + continue; + } + } catch (\UnexpectedValueException $e) { + //Shares are not identical } // Identical share already existst @@ -569,7 +573,11 @@ class Manager implements IManager { throw new \Exception('The Share API is disabled'); } - $originalShare = $this->getShareById($share->getFullId()); + try { + $originalShare = $this->getShareById($share->getFullId()); + } catch (\UnexpectedValueException $e) { + throw new \InvalidArgumentException('Share does not have a full id'); + } // We can't change the share type! if ($share->getShareType() !== $originalShare->getShareType()) { @@ -674,10 +682,15 @@ class Manager implements IManager { * * @param \OCP\Share\IShare $share * @throws ShareNotFound + * @throws \InvalidArgumentException */ public function deleteShare(\OCP\Share\IShare $share) { // Just to make sure we have all the info - $share = $this->getShareById($share->getFullId()); + try { + $share = $this->getShareById($share->getFullId()); + } catch (\UnexpectedValueException $e) { + throw new \InvalidArgumentException('Share does not have a full id'); + } $formatHookParams = function(\OCP\Share\IShare $share) { // Prepare hook |