anomalyco / anomalyco/opencode
Git quoted paths containing literal Unicode are corrupted during decoding
@Brendonovich is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Quoted Git paths containing literal Unicode are corrupted by the app path helper and the legacy session-diff decoder. Both place UTF-16 code units into a byte array and then decode that array as UTF-8.
With core.quotePath=false, a filename such as 中文".txt is emitted as "中文\".txt". OpenCode decodes it as -�".txt, producing a different path. Ordinary unquoted Unicode filenames work correctly.
Steps to reproduce
From this repository's packages/app directory:
bun -e 'import { unquoteGitPath } from "./src/context/file/path"; const name = String.fromCodePoint(0x4e2d, 0x6587, 34) + ".txt"; console.log(unquoteGitPath(JSON.stringify(name)))'
Expected: 中文".txt. Actual: -�".txt.
The input was also verified against real git -c core.quotePath=false diff --numstat output on macOS. Tabs and backslashes combined with Unicode trigger the same decoding error.
This report is scoped to pathname decoding; snapshot content lookup for quoted paths has a separate limitation.
OpenCode version
1.18.28; dev commit 5cf9f517cf
Operating System
macOS 27.0 arm64, Bun 1.3.14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.