mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(files): use isDownloadable for isSyncable
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
This commit is contained in:
parent
a7509ae2b8
commit
7bbc42809e
1 changed files with 7 additions and 19 deletions
|
|
@ -37,7 +37,6 @@ export function isDownloadable(node: Node): boolean {
|
|||
return true
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check permissions on the node if it can be synced/open locally
|
||||
*
|
||||
|
|
@ -45,25 +44,14 @@ export function isDownloadable(node: Node): boolean {
|
|||
* @return True if syncable, false otherwise
|
||||
*/
|
||||
export function isSyncable(node: Node): boolean {
|
||||
if (!node.isDavResource) {
|
||||
return false
|
||||
}
|
||||
|
||||
if ((node.permissions & Permission.UPDATE) === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// check hide-download property of shares
|
||||
if (node.attributes['hide-download'] === true
|
||||
|| node.attributes['hide-download'] === 'true'
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If the mount type is a share, ensure it got download permissions.
|
||||
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 !== undefined) {
|
||||
return downloadAttribute.value === true
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
// Syncable has the same permissions as downloadable for now
|
||||
return isDownloadable(node)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue