Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions lib/private/Share20/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/

namespace OC\Share20;

use OC\User\NoUserException;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\File;
Expand Down Expand Up @@ -133,20 +135,24 @@ public function getNode(): Node {
throw new NotFoundException();
}

// for federated shares the owner can be a remote user, in this
// case we use the initiator
if ($this->userManager->userExists($this->shareOwner)) {
$userFolder = $this->rootFolder->getUserFolder($this->shareOwner);
} else {
$userFolder = $this->rootFolder->getUserFolder($this->sharedBy);
try {
// for federated shares the owner can be a remote user, in this
// case we use the initiator
if ($this->userManager->userExists($this->shareOwner)) {
$userFolder = $this->rootFolder->getUserFolder($this->shareOwner);
} else {
$userFolder = $this->rootFolder->getUserFolder($this->sharedBy);
}

$node = $userFolder->getFirstNodeById($this->fileId);
if (!$node) {
throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
}

$this->node = $node;
} catch (NoUserException $e) {
throw new NotFoundException('Owner for share not found, fileid: ' . $this->fileId, previous:$e);
}

$node = $userFolder->getFirstNodeById($this->fileId);
if (!$node) {
throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId);
}

$this->node = $node;
}

return $this->node;
Expand Down
Loading