mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-22 06:15:59 +00:00
Fix URL Sharing
This commit is contained in:
1 parent
2c1c9b5e08
commit
2ee021b64d
1 file changed
+5
-4
@@ -57,8 +57,10 @@ class ShareViewController: NSViewController, ShareExtensionDelegate {
|
|||||||
self.zipFolderAndSetUpIcon()
|
self.zipFolderAndSetUpIcon()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for attachment in attachments {
|
|
||||||
if attachment.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
|
let filteredAttachments = attachments.filter { $0.hasItemConformingToTypeIdentifier(kUTTypeURL as String) }
|
||||||
|
|
||||||
|
for attachment in filteredAttachments {
|
||||||
attachment.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { data, _ in
|
attachment.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { data, _ in
|
||||||
if let urlData = data as? Data,
|
if let urlData = data as? Data,
|
||||||
let url = URL(dataRepresentation: urlData, relativeTo: nil, isAbsolute: false)
|
let url = URL(dataRepresentation: urlData, relativeTo: nil, isAbsolute: false)
|
||||||
@@ -68,7 +70,7 @@ class ShareViewController: NSViewController, ShareExtensionDelegate {
|
|||||||
self.urls.append(url as URL)
|
self.urls.append(url as URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.urls.count == attachments.count {
|
if self.urls.count == filteredAttachments.count {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.zipFolderAndSetUpIcon()
|
self.zipFolderAndSetUpIcon()
|
||||||
}
|
}
|
||||||
@@ -76,7 +78,6 @@ class ShareViewController: NSViewController, ShareExtensionDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let cancelError = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: nil)
|
let cancelError = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: nil)
|
||||||
extensionContext!.cancelRequest(withError: cancelError)
|
extensionContext!.cancelRequest(withError: cancelError)
|
||||||
|
|||||||
Reference in new issue
Block a user