summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-21 18:55:58 +0200
committerRobin Appelman <robin@icewind.nl>2016-10-12 16:12:37 +0200
commitf63f0aa1ae338b6599a591faf9d35d82e9f78457 (patch)
treec743dfdb1c41a94488d193e90a4e3e528bea7b0d /apps
parent9754724c8b3afca625d9f6f4bbd3442c50c8ad33 (diff)
downloadnextcloud-server-f63f0aa1ae338b6599a591faf9d35d82e9f78457.tar.gz
nextcloud-server-f63f0aa1ae338b6599a591faf9d35d82e9f78457.zip
get node by path as fallback
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/API/Share20OCS.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/API/Share20OCS.php b/apps/files_sharing/lib/API/Share20OCS.php
index d5a6d8bc9db..ac9ddc1fffa 100644
--- a/apps/files_sharing/lib/API/Share20OCS.php
+++ b/apps/files_sharing/lib/API/Share20OCS.php
@@ -140,10 +140,14 @@ class Share20OCS extends OCSController {
$nodes = $userFolder->getById($share->getNodeId());
if (empty($nodes)) {
- throw new NotFoundException();
+ // fallback to guessing the path
+ $node = $userFolder->get($share->getTarget());
+ if ($node === null) {
+ throw new NotFoundException();
+ }
+ } else {
+ $node = $nodes[0];
}
-
- $node = $nodes[0];
}
$result['path'] = $userFolder->getRelativePath($node->getPath());
@@ -405,8 +409,6 @@ class Share20OCS extends OCSController {
try {
$share = $this->shareManager->createShare($share);
- $userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
- $recipientNode = $userFolder->get($share->getTarget());
} catch (GenericShareException $e) {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code);
@@ -416,7 +418,7 @@ class Share20OCS extends OCSController {
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
}
- $output = $this->formatShare($share, $recipientNode);
+ $output = $this->formatShare($share);
return new DataResponse($output);
}