Skip to content

Commit 8d8664e

Browse files
committed
Use path to determine the share mount
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent c21952b commit 8d8664e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/private/Share20/Manager.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
use OCP\Files\IRootFolder;
5353
use OCP\Files\Mount\IMountManager;
5454
use OCP\Files\Node;
55+
use OCP\Files\NotFoundException;
5556
use OCP\HintException;
5657
use OCP\IConfig;
5758
use OCP\IGroupManager;
@@ -292,13 +293,9 @@ protected function generalCreateChecks(IShare $share) {
292293
$permissions = 0;
293294

294295
if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
295-
$userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function ($mount) use ($share) {
296-
// We need to filter since there might be other mountpoints that contain the file
297-
// e.g. if the user has access to the same external storage that the file is originating from
298-
return $mount->getStorage()->instanceOfStorage(ISharedStorage::class) && $mount->getPath() === $share->getNode()->getPath();
299-
});
300-
$userMount = array_shift($userMounts);
301-
if ($userMount === null) {
296+
try {
297+
$userMount = $this->rootFolder->get($share->getNode()->getPath());
298+
} catch (NotFoundException $e) {
302299
throw new GenericShareException('Could not get proper share mount for ' . $share->getNode()->getId() . '. Failing since else the next calls are called with null');
303300
}
304301
$mount = $userMount->getMountPoint();

0 commit comments

Comments
 (0)