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(app): binary file handling in file view by alexyaroshuk · Pull Request #11312 · anomalyco/opencode

Conversation

@alexyaroshuk

@alexyaroshuk alexyaroshuk commented Jan 30, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Related Issues

Addresses #11126 - Extension-based binary detection

Fixes app freeze for all binary files with recognized extensions (93 types).
Note: Extensionless binaries require content-based detection (follow-up needed).

What this PR addresses:

  • Binary files with extensions (.exe, .apk, .bin, etc.) → Fixed
  • Uppercase extensions → Fixed
  • App freeze on binary files → Fixed for most cases

What remains for follow-up:

  • Extensionless binaries (common on macOS/Linux)
  • Content-based detection (null byte, non-printable ratio)
  • See issue for full suggested implementation using tool/read.ts logic

What does this PR do?

1. Binary file handling

Prevents rendering garbage text and freezing when opening binary files. Added detection for 90+ binary extensions: exe, dll, pdb, apk, ipa, wav, mp3, mp4, avi, zip, tar, gz, pdf, doc, docx, and more.

  • Backend returns type: "binary" immediately without loading file content
  • Frontend displays "Binary file (content cannot be displayed)" with the filename

Before: App would freeze when clicking binaries (.exe, .apk, etc.) or on startup if these files were open in the previous session.

image

After: App instantly shows binary file placeholder without loading content.
image

Also prevents attempting to render video, audio, and other non-image binary content:
Before:
image

After:
image

  1. Uppercase/mixed case extension support
    Fixes images with uppercase extensions (.PNG, .JPG, .GIF) or mixed case (pNG, JPg, etc.) not rendering
    Added explicit image extension detection (png, jpg, gif, webp, svg, etc.)
    Maps extensions to correct MIME types regardless of case
    SDK type updates - Updated FileContent.type from "text" to "text" | "binary" to support new backend response

Before: extension case sensitive
image
image
image

After: no difference in file name extension case
image
image

  1. SDK type updates
    Updated FileContent.type from "text" to "text" | "binary" in SDK v1 and v2 to support the new backend response format.

  2. Localization
    Added translation key session.files.binaryContent for 15 languages

How did you verify your code works?

  • TypeScript: All packages pass typecheck

  • Test suite: 721 pass (+2), 61 fail (-2) — 2 previously failing tests now pass
    loads config from .opencode directory (was timing out)
    deduplicates duplicate instructions from global and local configs (was timing out)

  • E2E tests: All 22 tests pass

  • Manual testing:

    • Clicking .exe, .apk, .zip shows "Binary file" message instantly
    • .PNG, .JPG, .GIF, .pNG, jPG render correctly as images
    • videos, audio files also render "Binary file"
    • No app freeze when opening binary files or restarting with them open

Sorry, something went wrong.

Uh oh!

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

All reactions
opencode and others added 4 commits January 30, 2026 06:48
opencode
release: v1.1.45
e1e356c
@rekram1-node @opencode-agent
fix: rm ai sdk middleware that was preventing <think> blocks from bei…
00637c0
…ng sent back as assistant message content (anomalyco#11270)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
@alexyaroshuk
add binary file handling, add localization for new message
62d92cf
@alexyaroshuk
fix uppercase image extensions and improve binary file UI
8189f0f
@alexyaroshuk
alexyaroshuk requested a review from adamdotdevin as a code owner January 30, 2026 12:55
@github-actions github-actions Bot added contributor needs:issue labels Jan 30, 2026
@github-actions

github-actions Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexyaroshuk
Optimize file extension detection performance
824962c
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 4 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@alexyaroshuk
Revert "Optimize file extension detection performance"
b2b4bdf
This reverts commit 824962c.
@github-actions github-actions Bot mentioned this pull request Jan 30, 2026
fix(tui): read tool uppercase/mixed case image extensions #11333
Closed
opencode-agent Bot added a commit that referenced this pull request Jan 30, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
827be3f
opencode-agent Bot added a commit that referenced this pull request Jan 30, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
e9c400f
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
06957bb
@alexyaroshuk
Merge remote-tracking branch 'upstream/dev' into fix/binary-files-clean
7903dfa
@alexyaroshuk

alexyaroshuk commented Jan 31, 2026

Copy link
Copy Markdown
Contributor Author

(OC agent): conflicts resolved

All reactions

Sorry, something went wrong.

Uh oh!

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

opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
32d8dac
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
59bda41
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
533db63
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
a86e4ea
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
b8ff8ac
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
5fd3f39
opencode-agent Bot added a commit that referenced this pull request Jan 31, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
242ba5a
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
69cf9ab
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
9b5bb95
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
3eea197
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
b7117ed
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
c24730b
opencode-agent Bot added a commit that referenced this pull request Feb 1, 2026
@opencode-agent
Apply PR #11312: fix(app): binary file handling in file view
cf95fae
@adolago adolago mentioned this pull request Feb 14, 2026
[Opencode Sync] App: Localization and i18n adolago/zee#304
Closed
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamdotdevin adamdotdevin Awaiting requested review from adamdotdevin

Uh oh!

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

Assignees

No one assigned

Labels

contributor needs:issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@alexyaroshuk @adamdotdevin @rekram1-node
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.