From 6e267d336396946e2e32be68e6b6d8a1cd85b60b Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Fri, 3 Jul 2026 12:52:16 +0200 Subject: [PATCH] macOS: use the `getOpinionatedStringContents` same as paste --- .../Surface View/SurfaceView_AppKit.swift | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index 272f16e5a..7e76e3554 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -2220,7 +2220,6 @@ extension Ghostty.SurfaceView { static let dropTypes: Set = [ .string, .fileURL, - .URL ] override func draggingEntered(_ sender: any NSDraggingInfo) -> NSDragOperation { @@ -2240,24 +2239,7 @@ extension Ghostty.SurfaceView { override func performDragOperation(_ sender: any NSDraggingInfo) -> Bool { let pb = sender.draggingPasteboard - let content: String? - if let url = pb.string(forType: .URL) { - // URLs first, they get escaped as-is. - content = Ghostty.Shell.escape(url) - } else if let urls = pb.readObjects(forClasses: [NSURL.self]) as? [URL], - urls.count > 0 { - // File URLs next. They get escaped individually and then joined by a - // space if there are multiple. - content = urls - .map { Ghostty.Shell.escape($0.path) } - .joined(separator: " ") - } else if let str = pb.string(forType: .string) { - // Strings are not escaped because they may be copy/pasting a - // command they want to execute. - content = str - } else { - content = nil - } + let content = pb.getOpinionatedStringContents() if let content { DispatchQueue.main.async {