diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-11 14:00:15 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-10-11 14:00:15 +0200 |
commit | 8e3f21d9ed74d2ec33a2093a2a577b34d1503c47 (patch) | |
tree | 708257c56f156c27a2d77dcf876d3b427f8d8820 /apps/files_sharing/lib | |
parent | cf39885b539e15ee39f40486370ac7baafa90d82 (diff) | |
download | nextcloud-server-8e3f21d9ed74d2ec33a2093a2a577b34d1503c47.tar.gz nextcloud-server-8e3f21d9ed74d2ec33a2093a2a577b34d1503c47.zip |
Small progress with fixing unit tests
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
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)) { |