From ca298eff87aa96f15c98534cb38868a2dda115e6 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 7 Mar 2023 13:47:01 +0100 Subject: [PATCH] Handle version item requests in fetchContents of FileProviderExtension per the documentation Signed-off-by: Claudio Cambra --- .../FileProviderExt/FileProviderExtension.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift index 2a5dbd87e..5653e5e6d 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift @@ -112,6 +112,19 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm NSLog("Received request to fetch contents of item with identifier: %@", itemIdentifier.rawValue) + guard requestedVersion == nil else { + // TODO: Add proper support for file versioning + NSLog("Can't return contents for specific version as this is not supported.") + completionHandler(nil, nil, NSError(domain: NSCocoaErrorDomain, code: NSFeatureUnsupportedError, userInfo:[:])) + return Progress() + } + + guard ncAccount != nil else { + NSLog("Not fetching contents item: %@ as account not set up yet", itemIdentifier.rawValue) + completionHandler(nil, nil, NSFileProviderError(.notAuthenticated)) + return Progress() + } + let dbManager = NextcloudFilesDatabaseManager.shared let ocId = itemIdentifier.rawValue guard let metadata = dbManager.itemMetadataFromOcId(ocId) else { -- 2.30.2