Skip to content

Commit bd56261

Browse files
committed
fix: use canDownload for permissions on federated shares
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 67392e4 commit bd56261

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use OCP\AppFramework\Http\Attribute\OpenAPI;
1818
use OCP\AppFramework\Http\Attribute\PublicPage;
1919
use OCP\AppFramework\Http\JSONResponse;
20-
use OCP\Constants;
2120
use OCP\Federation\ICloudIdManager;
2221
use OCP\HintException;
2322
use OCP\Http\Client\IClientService;
@@ -107,9 +106,9 @@ public function createFederatedShare($shareWith, $token, $password = '') {
107106
return $response;
108107
}
109108

110-
if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
109+
if (!$share->canDownload()) {
111110
$response = new JSONResponse(
112-
['message' => 'Mounting file drop not supported'],
111+
['message' => 'Mounting download restricted share is not allowed'],
113112
Http::STATUS_BAD_REQUEST
114113
);
115114
$response->throttle();

apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function renderPage(IShare $share, string $token, string $path): Template
155155

156156
// Create the header action menu
157157
$headerActions = [];
158-
if ($view !== 'public-file-drop' && !$share->getHideDownload()) {
158+
if ($share->canDownload() && !$share->getHideDownload()) {
159159
// The download URL is used for the "download" header action as well as in some cases for the direct link
160160
$downloadUrl = $this->urlGenerator->getAbsoluteURL('/public.php/dav/files/' . $token . '/?accept=zip');
161161

0 commit comments

Comments
 (0)