Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(files): Sanitize share-types attribute in download action
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and backportbot[bot] committed Apr 16, 2024
commit 3091c31d6e57036b0d588b75aaa2c7e0ab2f18a5
3 changes: 2 additions & 1 deletion apps/files/src/actions/downloadAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down