summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-06-19 16:25:49 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-07-09 12:33:26 +0000
commitbb9da2577298e967dcb36abf29dd1278da7d633f (patch)
treee28810c0f740c5254445e7772171dbcbaaeb1201 /lib
parent84ac834a34386f4640ba829fe81feedb579c551e (diff)
downloadnextcloud-server-bb9da2577298e967dcb36abf29dd1278da7d633f.tar.gz
nextcloud-server-bb9da2577298e967dcb36abf29dd1278da7d633f.zip
Use the correct mountpoint to calculate
If we use the owners mount point this results in null. And then the rest of the checks get called with null. Which doesn't work. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Share20/Manager.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 9e7f034add4..c8ba04a4636 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -299,13 +299,20 @@ class Manager implements IManager {
$isFederatedShare = $share->getNode()->getStorage()->instanceOfStorage('\OCA\Files_Sharing\External\Storage');
$permissions = 0;
- $mount = $share->getNode()->getMountPoint();
+
+ $userMounts = $userFolder->getById($share->getNode()->getId());
+ $userMount = array_shift($userMounts);
+ $mount = $userMount->getMountPoint();
if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
// When it's a reshare use the parent share permissions as maximum
$userMountPointId = $mount->getStorageRootId();
$userMountPoints = $userFolder->getById($userMountPointId);
$userMountPoint = array_shift($userMountPoints);
+ if ($userMountPoint === null) {
+ throw new GenericShareException('Could not get proper user mount for ' . $userMountPointId . '. Failing since else the next calls are called with null');
+ }
+
/* Check if this is an incoming share */
$incomingShares = $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_USER, $userMountPoint, -1, 0);
$incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), Share::SHARE_TYPE_GROUP, $userMountPoint, -1, 0));