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
Prev Previous commit
Next Next commit
fix(files): use isDownloadable for isSyncable
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Nov 28, 2025
commit 7bbc42809e935b70a613b85c107e2d05e04fa329
22 changes: 5 additions & 17 deletions apps/files/src/utils/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,21 @@ export function isDownloadable(node: Node): boolean {
return true
}


/**
* Check permissions on the node if it can be synced/open locally
*
* @param node The node to check
* @return True if syncable, false otherwise
*/
export function isSyncable(node: Node): boolean {
if ((node.permissions & Permission.UPDATE) === 0) {
if (!node.isDavResource) {
return false
}

// check hide-download property of shares
if (node.attributes['hide-download'] === true
|| node.attributes['hide-download'] === 'true'
) {
if ((node.permissions & Permission.UPDATE) === 0) {
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)
}