orca icon indicating copy to clipboard operation
orca copied to clipboard

Terminal: pasting an OS-file-manager-copied file should insert its full shell-escaped path

Open hongdroid94 opened this issue 4 months ago • 5 comments

Problem

When I copy a file in Finder (Cmd+C) and paste it into a terminal pane running an agent CLI (e.g. Claude Code) with Cmd+V, only the filename is inserted — not the full path.

Expected: the paste should insert the file's full, shell-escaped POSIX path (e.g. /Users/me/project/src/App.tsx), which is what agents need when you reference a file.

For comparison, cmux (built on Ghostty/libghostty) already does this — pasting an OS-file-manager-copied file yields the full path in the terminal.

Root cause (from source)

The terminal paste handler src/renderer/src/lib/app-menu-paste.ts (handleAppMenuPasteRequest) only reads the clipboard text flavor via readClipboardText. On macOS, a Finder-copied file lives on the pasteboard as a file-URL (public.file-url), whose plain-text representation is just the display name — so only the filename comes through. The paste path never inspects the file/uri-list flavor.

The conversion logic already exists in the codebase but is only wired into drag-and-drop and Explorer→OS copy, not terminal paste:

  • src/shared/file-uri-path.ts — fileUriToFilesystemPath() / filesystemPathToFileUri()
  • src/main/window/clipboard-file-copy.ts — text/uri-list handling
  • src/shared/native-file-drop.ts, src/renderer/src/hooks/useGlobalFileDrop.ts — drop wiring

Proposed fix

On terminal paste, when the clipboard carries file entries (public.file-url / text/uri-list) and no meaningful plain text, resolve them to filesystem paths via fileUriToFilesystemPath() and insert them shell-escaped (space-separated for multiple files) instead of falling back to the display-name text.

Environment

  • Orca v1.4.128 (latest at time of filing)
  • macOS
  • Terminal pane running Claude Code

Workarounds today

  • Finder → Cmd+Option+C ("Copy as Pathname") copies the full path as plain text, which pastes correctly.
  • Drag-and-drop a file into Orca (composer/sidebar) works since native-file-drop is wired.

hongdroid94 avatar Jul 08 '26 05:07 hongdroid94

Still reproducible on Orca 1.4.205 (macOS 27.0), so this hasn't been fixed since 1.4.128.

I paste files into Claude Code running in an Orca terminal all the time, and getting just dictionary.md instead of the path means the agent can't find the file. I end up switching back to Finder to copy it again with Cmd+Option+C, which gets old fast.

The pasteboard does contain the full path. Here's what it holds right after Cmd+C on a file in Finder:

$ osascript -e 'clipboard info'
«class furl», 34, «class ut16», 28, «class utf8», 13, ... Unicode text, 26, string, 13, ...

$ osascript -e 'the clipboard as text'
dictionary.md

$ osascript -e 'POSIX path of (the clipboard as «class furl»)'
/Users/bleet/Downloads/dictionary.md

So the file URL is right there. Orca just reads the text flavor, which is only the display name. I checked the 1.4.205 bundle, and the terminal paste path still only calls clipboard.readText(). The only file-flavor fallback I found is the Windows FileNameW branch in the image-paste handler.

Other macOS terminals I've used (iTerm2, Ghostty, Terminal.app) paste the full path here. It would be great if Orca did the same: when the pasteboard has file URLs, insert the shell-escaped POSIX path(s), space-separated for multiple files. That makes Finder → agent a single copy-paste.

Happy to test a build if that helps. Thanks!

bleeeet avatar Sep 19 '26 07:09 bleeeet

Consolidating #21616 into this report. It confirms the same Finder → Claude Code terminal paste failure on macOS 27.0 / Orca 1.4.205: Cmd+C supplies a public.file-url containing the full path, while Cmd+V inserts only the plain-text basename (dictionary.md). The copied-file URL evidence and shell-escaped/multiple-file requirement are already captured above. This report remains open.

nwparker avatar Oct 18 '26 10:10 nwparker

My use case is running Codex or Claude Code in Orca’s built-in SSH workspaces on macOS (Orca 1.4.245).

Dragging a local file into the terminal already uploads it and inserts the remote path. I would like pasting a file copied in Finder to reuse that same flow, without submitting the prompt automatically.

PR #19167 appears to cover this exact workflow. Is it the preferred implementation to follow? Ideally, this could also be invoked through a configurable Ctrl+V binding.

fatjyc avatar Oct 31 '26 08:10 fatjyc

Still reproducible on Orca 1.4.250 (macOS 26.5.2), and both paste entry points are affected:

  • Terminal paste → window.api.ui.readClipboardText → IPC clipboard:readText → main-process clipboard.readText(), i.e. only the text flavor.
  • Menu / native paste → ui:performNativePaste → webContents.paste(), which also ends up with the text flavor.

The file-flavor reader already exists in the shipped bundle: clipboard:readFilePaths parses NSFilenamesPboardType / public.file-url and converts with fileURLToPath. Since #23784 it is wired into the chat composer, but the terminal paste path still never checks it.

Because the plain-text representation of a Finder-copied file is only the display name, readClipboardText() alone can never produce the path. Preferring readClipboardFilePaths() on terminal paste (as #19167 / #19517 propose) would fix local panes; routing through the existing drop pipeline would also cover SSH / runtime targets.

Until then, ⌥⌘C (Copy as Pathname) remains the workaround. Thanks for keeping this open.

codingbooo avatar Nov 06 '26 03:11 codingbooo

Thanks to @nwparker, this is fixed on main: #38970 (merged 11-06) makes terminal paste read the clipboard's file list, so a file copied in Finder now pastes as its full, shell-quoted path instead of its name. That PR referenced #28869 rather than this issue, which may be why this one is still open.

@fatjyc, on your question about #19167: #38970 supersedes it, so I've closed mine. It sends pasted files through the same pipeline as a drop, and its description says SSH and paired-runtime terminals upload them first.

It shipped in v1.4.252, after the 1.4.250 report above, and is in the current v1.4.280:

$ gh api repos/stablyai/orca/compare/cd0111fa1e...v1.4.251 --jq .status
diverged
$ gh api repos/stablyai/orca/compare/cd0111fa1e...v1.4.252 --jq .status
ahead
$ gh api repos/stablyai/orca/compare/cd0111fa1e...v1.4.280 --jq .status
ahead

kimnamu avatar Nov 28 '26 00:11 kimnamu