summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-20 11:29:12 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-12 16:12:29 +0200
commit37eded7e7cda2ab421b573d3b6d9165a4fb9dc9a (patch)
tree569301944ad35148e4a06ce5953367abd9103a9e
parent0d842e0550a15b7b6c501dae2ec24a61b72ef8c9 (diff)
downloadnextcloud-server-37eded7e7cda2ab421b573d3b6d9165a4fb9dc9a.tar.gz
nextcloud-server-37eded7e7cda2ab421b573d3b6d9165a4fb9dc9a.zip
Always unlock node after trying to create a share
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/files_sharing/lib/API/Share20OCS.php4
-rw-r--r--lib/private/Share20/Share.php2
2 files changed, 4 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/API/Share20OCS.php b/apps/files_sharing/lib/API/Share20OCS.php
index 34f73c7ac07..5adfa640c00 100644
--- a/apps/files_sharing/lib/API/Share20OCS.php
+++ b/apps/files_sharing/lib/API/Share20OCS.php
@@ -402,8 +402,10 @@ class Share20OCS extends OCSController {
} catch (GenericShareException $e) {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code);
- }catch (\Exception $e) {
+ } catch (\Exception $e) {
throw new OCSForbiddenException($e->getMessage());
+ } finally {
+ $share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
}
$output = $this->formatShare($share);
diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php
index c565809c078..e3e8482f4e1 100644
--- a/lib/private/Share20/Share.php
+++ b/lib/private/Share20/Share.php
@@ -160,7 +160,7 @@ class Share implements \OCP\Share\IShare {
$nodes = $userFolder->getById($this->fileId);
if (empty($nodes)) {
- throw new NotFoundException();
+ throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
}
$this->node = $nodes[0];