From: Claudio Cambra Date: Wed, 17 Apr 2024 20:55:14 +0000 (+0800) Subject: Wrap access of itemUrl in security scoping X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~7^2~44^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a72ac3ebec5bf3c97115f33fa74db0f78e20a6fa;p=nextcloud-desktop.git Wrap access of itemUrl in security scoping Signed-off-by: Claudio Cambra --- diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareViewController.swift index e6d969e85..058708a65 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,11 +79,16 @@ 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, privacy: .public)")