From ed1b327b83fd15370aad8816705f9608bf1c7818 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Tue, 29 Oct 2024 18:58:40 +0100 Subject: [PATCH] fix(ShareApiController): Set hideDownload to inverse of allow download attribute Signed-off-by: fenn-cs --- apps/files_sharing/lib/Controller/ShareAPIController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 077eb4b35a360..d615c78aaa968 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -569,7 +569,6 @@ public function createShare( ?string $sendMail = null, ): DataResponse { $share = $this->shareManager->newShare(); - if ($permissions === null) { if ($shareType === IShare::TYPE_LINK || $shareType === IShare::TYPE_EMAIL) { @@ -637,6 +636,10 @@ public function createShare( if ($attributes !== null) { $share = $this->setShareAttributes($share, $attributes); + if ($shareAttributes = $share->getAttributes()) { + $downloadPermission = (bool) $shareAttributes->getAttribute('permissions', 'download'); + $share->setHideDownload(!$downloadPermission); + } } // Expire date