mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #41742 from nextcloud/backport/41685/stable28
[stable28] Ensure share has download permissions in F2V
This commit is contained in:
commit
919b448bb6
3 changed files with 20 additions and 6 deletions
|
|
@ -41,6 +41,22 @@ const downloadNodes = function(dir: string, nodes: Node[]) {
|
|||
triggerDownload(url)
|
||||
}
|
||||
|
||||
const isDownloadable = function(node: Node) {
|
||||
if ((node.permissions & Permission.READ) === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// 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')
|
||||
if (downloadAttribute !== undefined && downloadAttribute.enabled === false) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export const action = new FileAction({
|
||||
id: 'download',
|
||||
displayName: () => t('files', 'Download'),
|
||||
|
|
@ -59,9 +75,7 @@ export const action = new FileAction({
|
|||
return false
|
||||
}
|
||||
|
||||
return nodes
|
||||
.map(node => node.permissions)
|
||||
.every(permission => (permission & Permission.READ) !== 0)
|
||||
return nodes.every(isDownloadable)
|
||||
},
|
||||
|
||||
async exec(node: Node, view: View, dir: string) {
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue