Repository navigation
fix(clipboard): paste a macOS image copied beside its file URL - #27346
Conversation
When a screenshot tool saves a file and also copies the image, the pasteboard holds public.png and public.file-url, and Chromium reports only text/uri-list from availableFormats(). readClipboardImageSource() then saw no image and Cmd+V dropped the paste, although readImage() returns it. On macOS, also check public.png and public.tiff with clipboard.has() before giving up. Fixes stablyai#27345 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HzCzr11hHmaEhiUoGJCrDy
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable issue is identified that should prevent merging after the normal checks. Pre-merge checks |
|
nwparker
left a comment
There was a problem hiding this comment.
Reviewed the final change and reproduced the regression through Cmd+V in a hidden macOS Orca terminal. The patched build correctly saves and pastes PNG/TIFF data copied beside a file URL; image-only paste still works and file-only copies are ignored.
No blocking findings. The fallback stays metadata-only and macOS-only, preserves sender authorization and existing image limits, and uses the established remote-save paths. Added handler coverage for malformed data, limits, authorization, and SSH saving. All 152 focused clipboard tests, Node typecheck, changed-code quality, formatting, and the rebuilt Electron terminal check passed locally.
ELI5
On macOS, Cmd+V now pastes a screenshot into a terminal even when the screenshot tool also copies its saved file URL.
What Changed
Electron can advertise only
text/uri-listfor a clipboard containing both image data and a file URL. Orca previously treated that clipboard as having no image and pasted nothing.When the advertised formats contain no image, Orca now checks the native PNG and TIFF clipboard types on macOS. Recognized images use the existing PNG conversion, size validation, and local or remote save path. Image-only paste and Windows copied-image-file handling retain their existing paths.
Added handler tests for PNG/TIFF saving, file-only copies, malformed images, sender authorization, image limits, and SSH saving. Shortened the source comment and asserted that advertised images skip the native fallback.
Why
Checking native types recovers image data that the advertised format list omits, without decoding pixels or reading a copied file merely to detect an image. The fallback stays macOS-only and does not grant new clipboard access.
Linked Issue
Fixes #27345
Visual Proof
Before Cmd+V: the terminal receives nothing.
After Cmd+V: the terminal receives the generated
orca-paste-*.pngpath.Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/window/clipboard: 152 passed, 1 pre-existing skip.pnpm tc:node, changed-code quality gate, lint, and formatting passed.Full CI passed: all five unit shards, relay integration, static analysis/typechecking, and Linux/Windows packaging. An unchanged folder-publication test failed once and passed on a failed-job rerun.
Rebuilt Orca and drove Cmd+V through a hidden terminal using real macOS pasteboard data and Electron 43.7.5. PNG and TIFF beside a file URL fail before the fix and paste a PNG path afterward. Image-only paste works; file-URL-only copies are ignored.
Additional native probes covered JPEG, a missing copied file, malformed image data, plain text, and an empty clipboard.
SSH routing is covered by unit tests; no live SSH host or Claude Code session was exercised. The terminal test used an input recorder.
I manually tested these changes locally
Automated tests added/updated
AI Disclosure
The original fix was diagnosed and written with Claude Opus 5.5 via Claude Code. The contributor reported the regression from daily use, reviewed the fix, and verified the Electron APIs against the real screenshot clipboard.
Review
No blocking findings after adversarial review. Native detection does not decode images, file-only copies do not enter image saving, malformed images produce no file, and oversized images are rejected before saving or SSH lookup. Existing sender authorization and runtime-owned remote upload behavior remain in place. Linux and Windows do not probe macOS clipboard types.
Agent skill upstream boundary
Notes
The native chat image-presence check uses the same source selector and also recognizes this clipboard shape.
Checklist