GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): validate clipboard content type on Linux by h0wdee · Pull Request #23459 · anomalyco/opencode

Conversation

@h0wdee

@h0wdee h0wdee commented Apr 20, 2026

Copy link
Copy Markdown

Summary

  • Validate clipboard content using sniffAttachmentMime() before treating as PNG on Linux
  • Fixes text being incorrectly identified as image when pasting via Ctrl+V

Root Cause

On Linux, xclip -selection clipboard -t image/png -o outputs raw bytes even when clipboard contains text. The code only checked byteLength > 0, so text (e.g. Unicode like ¯\_(ツ)_/¯) was labeled as image/png and sent to the model, which failed with "could not process image".

Fix

Use the existing sniffAttachmentMime() function from media.ts to check for PNG magic bytes before returning clipboard content as an image. This is the same validation pattern used in the read tool.

Verification

  1. Copy text with Unicode: echo '¯\_(ツ)_/¯' | xclip -selection c
  2. Ctrl+V in OpenCode TUI
  3. Text now pastes correctly instead of failing with "could not process image"

Fixes #23458

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
h0wdee
fix(opencode): validate clipboard content type on Linux
b2556fd
On Linux, xclip/wl-paste output raw bytes even when clipboard contains
text (not an image). The code only checked byteLength > 0, so text was
incorrectly labeled as image/png and sent to the model, which failed
with 'could not process image'.

Use existing sniffAttachmentMime() to validate PNG magic bytes before
returning clipboard content as an image.

Fixes anomalyco#23458
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 20, 2026
@github-actions

github-actions Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found:

  • PR feat(tui): improve clipboard paste and drag-and-drop file handling on Linux #14552: "feat(tui): improve clipboard paste and drag-and-drop file handling on Linux"
    • feat(tui): improve clipboard paste and drag-and-drop file handling on Linux #14552
    • Why related: This PR also addresses clipboard handling on Linux. It may have overlapping concerns with the clipboard content validation fix, though it appears to be a broader feature PR rather than a bug fix. Worth reviewing to ensure no conflicts with the drag-and-drop changes.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@h0wdee h0wdee closed this Apr 20, 2026
@h0wdee h0wdee reopened this Apr 20, 2026
@h0wdee

h0wdee commented Apr 20, 2026

Copy link
Copy Markdown
Author

Updated PR description to match the template. All checks are passing. Could a maintainer remove the needs:compliance label? Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 20, 2026
@github-actions github-actions Bot closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Linux clipboard paste misidentifies text as image

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@h0wdee
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.