fix: use canDownload for permissions on federated shares

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2026-03-17 17:02:21 +01:00
parent 08495bfc0e
commit 7f8f86ab9a
No known key found for this signature in database
GPG key ID: 7E849AE05218500F
2 changed files with 3 additions and 4 deletions

View file

@ -18,7 +18,6 @@ use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Constants;
use OCP\Federation\ICloudIdManager;
use OCP\HintException;
use OCP\Http\Client\IClientService;
@ -108,9 +107,9 @@ class MountPublicLinkController extends Controller {
return $response;
}
if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
if (!$share->canDownload()) {
$response = new JSONResponse(
['message' => 'Mounting file drop not supported'],
['message' => 'Mounting download restricted share is not allowed'],
Http::STATUS_BAD_REQUEST
);
$response->throttle();

View file

@ -153,7 +153,7 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
// Create the header action menu
$headerActions = [];
if ($view !== 'public-file-drop' && !$share->getHideDownload()) {
if ($share->canDownload() && !$share->getHideDownload()) {
// The download URL is used for the "download" header action as well as in some cases for the direct link
$downloadUrl = $this->urlGenerator->getAbsoluteURL('/public.php/dav/files/' . $token . '/?accept=zip');