diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-04-15 18:09:09 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-04-17 12:43:36 +0200 |
commit | 0f232997e1986752c1944b3f2a1239f19ee7775b (patch) | |
tree | ff709f43797d50df1459efca23ede293a5bbef9a /apps | |
parent | e31e5429a87c7acaf7f8767b6b5208ad2cc7c103 (diff) | |
download | nextcloud-server-0f232997e1986752c1944b3f2a1239f19ee7775b.tar.gz nextcloud-server-0f232997e1986752c1944b3f2a1239f19ee7775b.zip |
fix(files): Sanitize `share-types` attribute in download action
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/downloadAction.ts | 3 |
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 } |