Skip to content

Commit fe662ba

Browse files
committed
fix: Exclude lock files from synchronization in case server is missing the required capability.
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
1 parent ee149ae commit fe662ba

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Sources/NextcloudFileProviderKit/Item/Item+LockFile.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ extension Item {
7373
progress.totalUnitCount = 1
7474

7575
guard await assertRequiredCapabilities(domain: domain, itemIdentifier: itemTemplate.itemIdentifier, account: account, remoteInterface: remoteInterface, logger: logger) else {
76-
return (nil, NSFileProviderError(.cannotSynchronize))
76+
logger.debug("Excluding lock file from synchronizing due to lack of server-side locking capability.", [.item: itemTemplate, .name: itemTemplate.filename])
77+
78+
let error = if #available(macOS 13.0, *) {
79+
NSFileProviderError(.excludedFromSync)
80+
} else {
81+
NSFileProviderError(.cannotSynchronize)
82+
}
83+
84+
return (nil, error)
7785
}
7886

7987
logger.info("Item to create is a lock file. Will attempt to lock the associated file on the server.", [.name: itemTemplate.filename])

0 commit comments

Comments
 (0)