Preserve full URL when pasting from clipboard

This commit is contained in:
Bryan Lee
2025-01-14 00:35:08 +08:00
parent 132c4f1f68
commit 08314d414f

View File

@ -15,7 +15,9 @@ extension NSPasteboard {
func getOpinionatedStringContents() -> String? {
if let urls = readObjects(forClasses: [NSURL.self]) as? [URL],
urls.count > 0 {
return urls.map { $0.path }.joined(separator: " ")
return urls
.map { $0.isFileURL ? $0.path : $0.absoluteString }
.joined(separator: " ")
}
return self.string(forType: .string)