Do not provide items if account is not set up correctly

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-08-01 16:21:01 +08:00 committed by Matthieu Gallien
parent 7413cf6735
commit 4012d43bb9

View file

@ -104,7 +104,15 @@ import OSLog
request _: NSFileProviderRequest, request _: NSFileProviderRequest,
completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void
) -> Progress { ) -> Progress {
if let item = Item.storedItem(identifier: identifier, remoteInterface: ncKit) { if ncAccount == nil {
Logger.fileProviderExtension.error(
"""
Not fetching item for identifier: \(identifier.rawValue, privacy: .public)
as account not set up yet.
"""
)
completionHandler(nil, NSFileProviderError(.notAuthenticated))
} else if let item = Item.storedItem(identifier: identifier, remoteInterface: ncKit) {
completionHandler(item, nil) completionHandler(item, nil)
} else { } else {
completionHandler(nil, NSFileProviderError(.noSuchItem)) completionHandler(nil, NSFileProviderError(.noSuchItem))