diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-02 14:32:20 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-09-06 03:38:47 +0200 |
commit | 1d16bc47ffe7fbbf3f98a773612df6cdfa56f7de (patch) | |
tree | 4c377028ab883b1144c4b917302eb17ef4d230ea /apps | |
parent | e93ceea804284800c1636e7ef199f40c1d33f0b3 (diff) | |
download | nextcloud-server-1d16bc47ffe7fbbf3f98a773612df6cdfa56f7de.tar.gz nextcloud-server-1d16bc47ffe7fbbf3f98a773612df6cdfa56f7de.zip |
fix(files_sharing): Handle download permission the same way for public and internal shares
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/downloadAction.ts | 10 | ||||
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 5 |
2 files changed, 10 insertions, 5 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') { |