Make sure not to check for kit before we should in shares table view data source

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-07-31 15:33:08 +08:00 committed by Matthieu Gallien
parent bcbfdc942e
commit 8533fdd4a0

View file

@ -70,10 +70,6 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele
presentError("No item URL, cannot reload data!") presentError("No item URL, cannot reload data!")
return return
} }
guard let kit else {
presentError("NextcloudKit instance is unavailable, cannot reload data!")
return
}
guard let itemIdentifier = await withCheckedContinuation({ guard let itemIdentifier = await withCheckedContinuation({
(continuation: CheckedContinuation<NSFileProviderItemIdentifier?, Never>) -> Void in (continuation: CheckedContinuation<NSFileProviderItemIdentifier?, Never>) -> Void in
NSFileProviderManager.getIdentifierForUserVisibleFile( NSFileProviderManager.getIdentifierForUserVisibleFile(
@ -113,6 +109,10 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele
presentError("Server does not support shares.") presentError("Server does not support shares.")
return return
} }
guard let kit else {
presentError("NextcloudKit instance is unavailable, cannot reload data!")
return
}
itemMetadata = await fetchItemMetadata(itemRelativePath: serverPathString, kit: kit) itemMetadata = await fetchItemMetadata(itemRelativePath: serverPathString, kit: kit)
guard itemMetadata?.permissions.contains("R") == true else { guard itemMetadata?.permissions.contains("R") == true else {
presentError("This file cannot be shared.") presentError("This file cannot be shared.")