aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/src/actions/downloadAction.ts10
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php5
-rw-r--r--build/integration/dav_features/dav-v2-public.feature2
3 files changed, 11 insertions, 6 deletions
diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts
index f1bcb97e279..bac5e4adf10 100644
--- a/apps/files/src/actions/downloadAction.ts
+++ b/apps/files/src/actions/downloadAction.ts
@@ -46,11 +46,11 @@ const isDownloadable = function(node: Node) {
}
// If the mount type is a share, ensure it got download permissions.
- if (node.attributes['mount-type'] === 'shared') {
- const shareAttributes = JSON.parse(node.attributes['share-attributes'] ?? '[]') as Array<ShareAttribute>
- const downloadAttribute = shareAttributes?.find?.((attribute: { scope: string; key: string }) => attribute.scope === 'permissions' && attribute.key === 'download')
- if (downloadAttribute !== undefined && downloadAttribute.value === false) {
- return false
+ if (node.attributes['share-attributes']) {
+ const shareAttributes = JSON.parse(node.attributes['share-attributes'] || '[]') as Array<ShareAttribute>
+ const downloadAttribute = shareAttributes.find(({ scope, key }: ShareAttribute) => scope === 'permissions' && key === 'download')
+ if (downloadAttribute) {
+ return downloadAttribute.value === true
}
}
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index ea2bb3fa668..3f8062ac2c9 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -1221,11 +1221,16 @@ class ShareAPIController extends OCSController {
}
// Update hide download state
+ $attributes = $share->getAttributes() ?? $share->newAttributes();
if ($hideDownload === 'true') {
$share->setHideDownload(true);
+ $attributes->setAttribute('permissions', 'download', false);
} elseif ($hideDownload === 'false') {
$share->setHideDownload(false);
+ $attributes->setAttribute('permissions', 'download', true);
}
+ $share->setAttributes($attributes);
+
$newPermissions = null;
if ($publicUpload === 'true') {
diff --git a/build/integration/dav_features/dav-v2-public.feature b/build/integration/dav_features/dav-v2-public.feature
index 773fc2c1d73..e35f7b9101f 100644
--- a/build/integration/dav_features/dav-v2-public.feature
+++ b/build/integration/dav_features/dav-v2-public.feature
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
Feature: dav-v2-public
Background: