Skip to content

Commit 37d89ce

Browse files
skjnldsvbackportbot[bot]
authored andcommitted
fix(files): use isDownloadable for isSyncable
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com> [skip ci]
1 parent 4b1477d commit 37d89ce

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

apps/files/src/utils/permissions.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,21 @@ export function isDownloadable(node: Node): boolean {
3636
return true
3737
}
3838

39-
4039
/**
4140
* Check permissions on the node if it can be synced/open locally
4241
*
4342
* @param node The node to check
4443
* @return True if syncable, false otherwise
4544
*/
4645
export function isSyncable(node: Node): boolean {
47-
if ((node.permissions & Permission.UPDATE) === 0) {
46+
if (!node.isDavResource) {
4847
return false
4948
}
5049

51-
// check hide-download property of shares
52-
if (node.attributes['hide-download'] === true
53-
|| node.attributes['hide-download'] === 'true'
54-
) {
50+
if ((node.permissions & Permission.UPDATE) === 0) {
5551
return false
5652
}
5753

58-
// If the mount type is a share, ensure it got download permissions.
59-
if (node.attributes['share-attributes']) {
60-
const shareAttributes = JSON.parse(node.attributes['share-attributes'] || '[]') as Array<ShareAttribute>
61-
const downloadAttribute = shareAttributes.find(({ scope, key }: ShareAttribute) => scope === 'permissions' && key === 'download')
62-
if (downloadAttribute !== undefined) {
63-
return downloadAttribute.value === true
64-
}
65-
}
66-
67-
return true
68-
}
54+
// Syncable has the same permissions as downloadable for now
55+
return isDownloadable(node)
56+
}

0 commit comments

Comments
 (0)