Prevent creation of symbolic link items in FileProviderExtension

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-03-07 13:59:18 +01:00
parent ca298eff87
commit 53d2fc0c1e
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -203,6 +203,12 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm
NSLog("Received create item request for item with identifier: %@ and filename: %@", itemTemplate.itemIdentifier.rawValue, itemTemplate.filename)
guard itemTemplate.contentType != .symbolicLink else {
NSLog("Cannot create item, symbolic links not supported.")
completionHandler(itemTemplate, NSFileProviderItemFields(), false, NSError(domain: NSCocoaErrorDomain, code: NSFeatureUnsupportedError, userInfo:[:]))
return Progress()
}
guard let ncAccount = ncAccount else {
NSLog("Not creating item: %@ as account not set up yet", itemTemplate.itemIdentifier.rawValue)
completionHandler(itemTemplate, NSFileProviderItemFields(), false, NSFileProviderError(.notAuthenticated))