]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always unlock node after trying to create a share
authorRobin Appelman <robin@icewind.nl>
Tue, 20 Sep 2016 09:29:12 +0000 (11:29 +0200)
committerRobin Appelman <robin@icewind.nl>
Wed, 12 Oct 2016 14:12:29 +0000 (16:12 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/API/Share20OCS.php
lib/private/Share20/Share.php

index 34f73c7ac07a623cd432a524dafa13a70f00d387..5adfa640c00f389c68bbbac04a5340c413e10018 100644 (file)
@@ -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);
index c565809c07889798a3287e2aa4867d04653a073d..e3e8482f4e18b75c522e438f655b583477bfb539 100644 (file)
@@ -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];