diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/DocumentActionViewController.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/DocumentActionViewController.swift
index dd068f0aca3a5..96363e962b124 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/DocumentActionViewController.swift
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/DocumentActionViewController.swift
@@ -34,7 +34,7 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
override func prepare(
forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]
) {
- Logger.actionViewController.info("Preparing for action: \(actionIdentifier)")
+ Logger.actionViewController.info("Preparing action: \(actionIdentifier, privacy: .public)")
if actionIdentifier == "com.nextcloud.desktopclient.FileProviderUIExt.ShareAction" {
prepare(childViewController: ShareViewController(itemIdentifiers))
@@ -43,7 +43,11 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
}
override func prepare(forError error: Error) {
- Logger.actionViewController.info("Preparing for error: \(error.localizedDescription)")
+ Logger.actionViewController.info(
+ """
+ Preparing for error: \(error.localizedDescription, privacy: .public)
+ """
+ )
}
override public func loadView() {
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExt.entitlements b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExt.entitlements
index 5d2a36d31b72d..eab912dc49600 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExt.entitlements
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExt.entitlements
@@ -8,5 +8,9 @@
$(OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX)$(OC_APPLICATION_REV_DOMAIN)
+ com.apple.security.network.client
+
+ com.apple.security.network.server
+
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExtRelease.entitlements b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExtRelease.entitlements
deleted file mode 100644
index eab912dc49600..0000000000000
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/FileProviderUIExtRelease.entitlements
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- com.apple.security.app-sandbox
-
- com.apple.security.application-groups
-
- $(OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX)$(OC_APPLICATION_REV_DOMAIN)
-
- com.apple.security.network.client
-
- com.apple.security.network.server
-
-
-
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/Info.plist b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/Info.plist
index f559d75c46ab4..85f108b15fc96 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/Info.plist
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/Info.plist
@@ -2,6 +2,12 @@
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundleDisplayName
+ $(OC_APPLICATION_NAME) File Provider UI Extension
+ CFBundleIdentifier
+ $(OC_APPLICATION_REV_DOMAIN).$(PRODUCT_NAME)
NSExtension
NSExtensionFileProviderActions
@@ -15,10 +21,10 @@
Share options
- NSExtensionPrincipalClass
- $(PRODUCT_MODULE_NAME).DocumentActionViewController
NSExtensionPointIdentifier
com.apple.fileprovider-actionsui
+ NSExtensionPrincipalClass
+ $(PRODUCT_MODULE_NAME).DocumentActionViewController
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareController.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareController.swift
index ba2666f8b542d..161d1870068d9 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareController.swift
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareController.swift
@@ -42,14 +42,18 @@ class ShareController: ObservableObject {
) { account, share, data, error in
defer { continuation.resume(returning: error) }
guard error == .success else {
- Logger.shareController.error("Error creating link share: \(error)")
+ Logger.shareController.error(
+ """
+ Error creating link share: \(error.errorDescription, privacy: .public)
+ """
+ )
return
}
}
} else {
guard let shareWith = shareWith else {
let errorString = "No recipient for share!"
- Logger.shareController.error("\(errorString)")
+ Logger.shareController.error("\(errorString, privacy: .public)")
let error = NKError(statusCode: 0, fallbackDescription: errorString)
continuation.resume(returning: error)
return
@@ -66,7 +70,11 @@ class ShareController: ObservableObject {
) { account, share, data, error in
defer { continuation.resume(returning: error) }
guard error == .success else {
- Logger.shareController.error("Error creating share: \(error)")
+ Logger.shareController.error(
+ """
+ Error creating share: \(error.errorDescription, privacy: .public)
+ """
+ )
return
}
}
@@ -90,7 +98,7 @@ class ShareController: ObservableObject {
attributes: String? = nil,
options: NKRequestOptions = NKRequestOptions()
) async -> NKError? {
- Logger.shareController.info("Saving share: \(self.share.url)")
+ Logger.shareController.info("Saving share: \(self.share.url, privacy: .public)")
return await withCheckedContinuation { continuation in
kit.updateShare(
idShare: share.idShare,
@@ -104,10 +112,18 @@ class ShareController: ObservableObject {
attributes: attributes,
options: options
) { account, share, data, error in
- Logger.shareController.info("Received update response: \(share?.url ?? "")")
+ Logger.shareController.info(
+ """
+ Received update response: \(share?.url ?? "", privacy: .public)
+ """
+ )
defer { continuation.resume(returning: error) }
guard error == .success, let share = share else {
- Logger.shareController.error("Error updating save: \(error.errorDescription)")
+ Logger.shareController.error(
+ """
+ Error updating save: \(error.errorDescription, privacy: .public)
+ """
+ )
return
}
self.share = share
@@ -116,13 +132,21 @@ class ShareController: ObservableObject {
}
func delete() async -> NKError? {
- Logger.shareController.info("Deleting share: \(self.share.url)")
+ Logger.shareController.info("Deleting share: \(self.share.url, privacy: .public)")
return await withCheckedContinuation { continuation in
kit.deleteShare(idShare: share.idShare) { account, error in
- Logger.shareController.info("Received delete response: \(self.share.url)")
+ Logger.shareController.info(
+ """
+ Received delete response: \(self.share.url, privacy: .public)
+ """
+ )
defer { continuation.resume(returning: error) }
guard error == .success else {
- Logger.shareController.error("Error deleting save: \(error.errorDescription)")
+ Logger.shareController.error(
+ """
+ Error deleting save: \(error.errorDescription, privacy: .public)
+ """
+ )
return
}
}
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift
index 516909055156d..995bc1f296524 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareOptionsView.swift
@@ -71,7 +71,7 @@ class ShareOptionsView: NSView {
}
var createMode = false {
didSet {
- Logger.shareOptionsView.info("Create mode set: \(self.createMode)")
+ Logger.shareOptionsView.info("Create mode set: \(self.createMode, privacy: .public)")
shareTypePicker.isHidden = !createMode
shareRecipientTextField.isHidden = !createMode
labelTextField.isHidden = createMode // Cannot set label on create API call
@@ -259,10 +259,10 @@ class ShareOptionsView: NSView {
let itemServerRelativePath = dataSource.itemServerRelativePath
else {
Logger.shareOptionsView.error("Cannot create new share due to missing data.")
- Logger.shareOptionsView.error("dataSource: \(self.dataSource)")
- Logger.shareOptionsView.error("kit: \(self.kit)")
+ Logger.shareOptionsView.error("dataSource: \(self.dataSource, privacy: .public)")
+ Logger.shareOptionsView.error("kit: \(self.kit, privacy: .public)")
Logger.shareOptionsView.error(
- "path: \(self.dataSource?.itemServerRelativePath ?? "")"
+ "path: \(self.dataSource?.itemServerRelativePath ?? "", privacy: .public)"
)
return
}
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift
index 70aeb8c50a7c0..3cca1d1a9df51 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareTableViewDataSource.swift
@@ -99,6 +99,7 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele
account = convertedAccount
await sharesTableView?.deselectAll(self)
capabilities = await fetchCapabilities()
+ guard capabilities != nil else { return }
guard capabilities?.filesSharing?.apiEnabled == true else {
presentError("Server does not support shares.")
return
diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift
index 55955f143984d..058708a653d9f 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift
+++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift
@@ -47,6 +47,13 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
return
}
+ Logger.shareViewController.info(
+ """
+ Instantiated with itemIdentifiers:
+ \(itemIdentifiers.map { $0.rawValue }, privacy: .public)
+ """
+ )
+
Task {
await processItemIdentifier(firstItem)
}
@@ -72,14 +79,19 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
do {
let itemUrl = try await manager.getUserVisibleURL(for: itemIdentifier)
+ guard itemUrl.startAccessingSecurityScopedResource() else {
+ Logger.shareViewController.error("Could not access scoped resource for item url!")
+ return
+ }
await updateDisplay(itemUrl: itemUrl)
shareDataSource.uiDelegate = self
shareDataSource.sharesTableView = tableView
shareDataSource.loadItem(url: itemUrl)
optionsView.dataSource = shareDataSource
+ itemUrl.stopAccessingSecurityScopedResource()
} catch let error {
let errorString = "Error processing item: \(error)"
- Logger.shareViewController.error("\(errorString)")
+ Logger.shareViewController.error("\(errorString, privacy: .public)")
fileNameLabel.stringValue = "Unknown item"
descriptionLabel.stringValue = errorString
}
@@ -99,7 +111,11 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
let fileThumbnail = await withCheckedContinuation { continuation in
generator.generateRepresentations(for: request) { thumbnail, type, error in
if thumbnail == nil || error != nil {
- Logger.shareViewController.error("Could not get thumbnail: \(error)")
+ Logger.shareViewController.error(
+ """
+ Could not get thumbnail: \(error, privacy: .public)
+ """
+ )
}
continuation.resume(returning: thumbnail)
}
diff --git a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj
index cd05dd8ef676e..aadb372da676a 100644
--- a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj
+++ b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj
@@ -157,7 +157,6 @@
536EFBF6295CF58100F4CB13 /* FileProviderSocketLineProcessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileProviderSocketLineProcessor.swift; sourceTree = ""; };
5374FD432B95EE1400C78D54 /* ShareController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareController.swift; sourceTree = ""; };
5376307C2B85E2ED0026BFAB /* Logger+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Logger+Extensions.swift"; sourceTree = ""; };
- 5376307E2B85E5650026BFAB /* FileProviderUIExt.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = FileProviderUIExt.entitlements; sourceTree = ""; };
537630902B85F4980026BFAB /* ShareViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareViewController.xib; sourceTree = ""; };
537630922B85F4B00026BFAB /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; };
537630942B860D560026BFAB /* FPUIExtensionServiceSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FPUIExtensionServiceSource.swift; sourceTree = ""; };
@@ -181,7 +180,7 @@
53D666602B70C9A70042C03D /* FileProviderConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileProviderConfig.swift; sourceTree = ""; };
53ED472F29C9CE0B00795DB1 /* FileProviderExtension+ClientInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileProviderExtension+ClientInterface.swift"; sourceTree = ""; };
53FE144F2B8E0658006C4193 /* ShareTableViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareTableViewDataSource.swift; sourceTree = ""; };
- 53FE14572B8E3A7C006C4193 /* FileProviderUIExtRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FileProviderUIExtRelease.entitlements; sourceTree = ""; };
+ 53FE14572B8E3A7C006C4193 /* FileProviderUIExt.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FileProviderUIExt.entitlements; sourceTree = ""; };
53FE14582B8E3F6C006C4193 /* ShareTableItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareTableItemView.swift; sourceTree = ""; };
53FE145A2B8F1305006C4193 /* NKShare+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NKShare+Extensions.swift"; sourceTree = ""; };
53FE14642B8F6700006C4193 /* ShareViewDataSourceUIDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewDataSourceUIDelegate.swift; sourceTree = ""; };
@@ -329,8 +328,7 @@
537630922B85F4B00026BFAB /* ShareViewController.swift */,
537630902B85F4980026BFAB /* ShareViewController.xib */,
53FE14642B8F6700006C4193 /* ShareViewDataSourceUIDelegate.swift */,
- 5376307E2B85E5650026BFAB /* FileProviderUIExt.entitlements */,
- 53FE14572B8E3A7C006C4193 /* FileProviderUIExtRelease.entitlements */,
+ 53FE14572B8E3A7C006C4193 /* FileProviderUIExt.entitlements */,
53B979852B84C81F002DA742 /* Info.plist */,
);
path = FileProviderUIExt;
@@ -1023,7 +1021,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = FileProviderUIExt/Info.plist;
- INFOPLIST_KEY_CFBundleDisplayName = FileProviderUIExt;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_OUTPUT_FORMAT = "same-as-input";
INFOPLIST_PREPROCESS = NO;
@@ -1070,7 +1067,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CODE_SIGN_ENTITLEMENTS = FileProviderUIExt/FileProviderUIExtRelease.entitlements;
+ CODE_SIGN_ENTITLEMENTS = FileProviderUIExt/FileProviderUIExt.entitlements;
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
@@ -1084,7 +1081,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = FileProviderUIExt/Info.plist;
- INFOPLIST_KEY_CFBundleDisplayName = FileProviderUIExt;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_OUTPUT_FORMAT = "same-as-input";
INFOPLIST_PREPROCESS = NO;