Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Small progress with fixing unit tests
Signed-off-by: Carl Schwan <[email protected]>
  • Loading branch information
CarlSchwan authored and PVince81 committed Oct 27, 2022
commit 158b55747b5070b4f96240d13feb9ce9c264471e
7 changes: 5 additions & 2 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ public function createShare(
$share = $this->setShareAttributes($share, $attributes);
}

$share->setSharedBy($this->currentUser);
$this->checkInheritedAttributes($share);

if ($shareType === IShare::TYPE_USER) {
Expand Down Expand Up @@ -683,7 +684,6 @@ public function createShare(
}

$share->setShareType($shareType);
$share->setSharedBy($this->currentUser);

if ($note !== '') {
$share->setNote($note);
Expand Down Expand Up @@ -1884,10 +1884,13 @@ private function setShareAttributes(IShare $share, ?string $attributesString) {
}

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)) {
Expand Down
Loading