aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-04-15 18:09:09 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-04-16 11:24:57 +0200
commitc821f28014b6abe9847bbc3a02d471469430266f (patch)
treeee7bf61dbc2a1f91733bd630d2a431e5e3597564 /apps/files/src
parentfea0278947cafcd62877226dc5ddece04d596a98 (diff)
downloadnextcloud-server-c821f28014b6abe9847bbc3a02d471469430266f.tar.gz
nextcloud-server-c821f28014b6abe9847bbc3a02d471469430266f.zip
fix(files): Sanitize `share-types` attribute in download action
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/actions/downloadAction.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts
index 5afec375e99..de2fa081166 100644
--- a/apps/files/src/actions/downloadAction.ts
+++ b/apps/files/src/actions/downloadAction.ts
@@ -48,7 +48,8 @@ const isDownloadable = function(node: Node) {
// If the mount type is a share, ensure it got download permissions.
if (node.attributes['mount-type'] === 'shared') {
- const downloadAttribute = JSON.parse(node.attributes['share-attributes']).find((attribute: { scope: string; key: string }) => attribute.scope === 'permissions' && attribute.key === 'download')
+ const shareAttributes = JSON.parse(node.attributes['share-attributes'] ?? 'null')
+ const downloadAttribute = shareAttributes?.find?.((attribute: { scope: string; key: string }) => attribute.scope === 'permissions' && attribute.key === 'download')
if (downloadAttribute !== undefined && downloadAttribute.enabled === false) {
return false
}