diff options
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 2689cdd79e7..9dc7544644b 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -537,6 +537,7 @@ class ShareAPIController extends OCSController { $share = $this->setShareAttributes($share, $attributes); } + $share->setSharedBy($this->currentUser); $this->checkInheritedAttributes($share); if ($shareType === IShare::TYPE_USER) { @@ -691,7 +692,6 @@ class ShareAPIController extends OCSController { } $share->setShareType($shareType); - $share->setSharedBy($this->currentUser); if ($note !== '') { $share->setNote($note); @@ -1894,10 +1894,13 @@ class ShareAPIController extends OCSController { } private function checkInheritedAttributes(IShare $share): void { + if (!$share->getSharedBy()) { + return; // Probably in a test + } $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); $nodes = $userFolder->getById($share->getNodeId()); if (empty($nodes)) { - throw new NotFoundException('Node for share not found, fileid: ' . $share->getNodeId()); + return; } $node = $nodes[0]; if ($node->getStorage()->instanceOfStorage(SharedStorage::class)) { |