Skip to content

fix(clipboard): paste a macOS image copied beside its file URL - #27346

Merged
nwparker merged 2 commits into
stablyai:mainfrom
benjaminb10:fix/clipboard-image-with-file-url
Oct 11, 2026
Merged

nwparker merged 2 commits into
stablyai:mainfrom
benjaminb10:fix/clipboard-image-with-file-url

Conversation

@benjaminb10

@benjaminb10 benjaminb10 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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-list for 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.

Before: image plus file URL paste is dropped

After Cmd+V: the terminal receives the generated orca-paste-*.png path.

After: image plus file URL pastes a PNG path

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

  • Not applicable; this change copies no upstream skill-installer source or related resources.

Notes

The native chat image-presence check uses the same source selector and also recognizes this clipboard shape.

Checklist

  • This PR is small and focused
  • I explained the user-facing before/after, mechanism, and approach
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH/remote impact considered
  • Focused tests, Node typecheck, changed-code quality, and an Electron build passed locally; full CI passed

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
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 700e0d1f-abff-486b-81f7-0cb1df22c670



📥 Commits

Reviewing files that changed from the base of the PR and between d0bc69b and dcf672e.




📒 Files selected for processing (3)
  • src/main/window/clipboard-image-source.test.ts
  • src/main/window/clipboard-image-source.ts
  • src/main/window/clipboard-macos-image-paste.test.ts



🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/window/clipboard-image-source.ts



Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.





📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

On macOS, readClipboardImageSource checks for public.png and public.tiff pasteboard types. When either type is present, it returns a native image source with no Windows file formats. Tests cover platform-specific type checks and macOS image pasting, including invalid or oversized images and SSH-targeted images.





Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to dcf67

No actionable issue is identified that should prevent merging after the normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed The description links the relevant issue with Fixes #27345, which matches the clipboard regression addressed by the pull request.
Out of Scope Changes check Passed The changes are limited to macOS clipboard image detection and focused tests for local, remote, authorization, size, and cross-platform behavior.
Title check Passed The title clearly and concisely identifies the macOS clipboard fix for images copied with a file URL.
Description check Passed The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI use, review notes, cross-platform considerati…

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker nwparker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cmd+V drops a macOS screenshot that is copied together with its file URL (regression in v1.4.224)

2 participants