mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(files_sharing): Handle download permission the same way for public and internal shares
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
e93ceea804
commit
1d16bc47ff
3 changed files with 11 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue