Always unlock node after trying to create a share

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2016-09-20 11:29:12 +02:00
parent 0d842e0550
commit 37eded7e7c
No known key found for this signature in database
GPG Key ID: 425003AC385454C5
2 changed files with 4 additions and 2 deletions

View File

@ -402,8 +402,10 @@ class Share20OCS extends OCSController {
} catch (GenericShareException $e) { } catch (GenericShareException $e) {
$code = $e->getCode() === 0 ? 403 : $e->getCode(); $code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code); throw new OCSException($e->getHint(), $code);
}catch (\Exception $e) { } catch (\Exception $e) {
throw new OCSForbiddenException($e->getMessage()); throw new OCSForbiddenException($e->getMessage());
} finally {
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
} }
$output = $this->formatShare($share); $output = $this->formatShare($share);

View File

@ -160,7 +160,7 @@ class Share implements \OCP\Share\IShare {
$nodes = $userFolder->getById($this->fileId); $nodes = $userFolder->getById($this->fileId);
if (empty($nodes)) { if (empty($nodes)) {
throw new NotFoundException(); throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
} }
$this->node = $nodes[0]; $this->node = $nodes[0];