[PR #12549] fix(desktop): windows clipboard images come thru as data not file #14262

Open
opened 2026-02-16 18:19:04 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12549

State: open
Merged: No


What does this PR do?

Fixes a crash on Windows when pasting images from the clipboard.

The prompt pipeline treated clipboard images as file: URLs which throws on non‑file schemes like data: - for example a random screenshot using Snipping Tool file url path:

data:image/png;base64,iVBORw0KG....

If the URL isn’t a real file path, we log a warning and pass the file part through without attempting to read from disk. This prevents the hard failure while keeping existing behavior unchanged for valid file URLs.

How did you verify your code works?

  • Manually pasted an image from the clipboard on Windows 11; the prompt no longer crashes.
  • Verified normal file attachments still work as before.

Fixes #12547

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12549 **State:** open **Merged:** No --- ### What does this PR do? Fixes a crash on Windows when pasting images from the clipboard. The prompt pipeline treated clipboard images as `file:` URLs which throws on non‑file schemes like `data:` - for example a random screenshot using Snipping Tool file url path: `data:image/png;base64,iVBORw0KG....` If the URL isn’t a real file path, we log a warning and pass the file part through without attempting to read from disk. This prevents the hard failure while keeping existing behavior unchanged for valid file URLs. ### How did you verify your code works? - Manually pasted an image from the clipboard on Windows 11; the prompt no longer crashes. - Verified normal file attachments still work as before. Fixes #12547
yindo added the pull-request label 2026-02-16 18:19:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14262