opencode
opencode copied to clipboard
fix(webUI): handle non-ASCII filenames in snapshot diff
Summary
Fixes https://github.com/anomalyco/opencode/issues/7670 Same as https://github.com/anomalyco/opencode/issues/7408
This PR resolves on Web: when containing non-ASCII filenames, Path is error, so filenames and git diff will display uncorrect and cause SyntaxError.
Problem
- For non-ASCII filenames (CN/KOR/JP) , Git emits quoted paths, so the filenames in session diffs don’t match the ones in snapshot diffs.
- shell interpretation can interfere with git show when paths contain Unicode characters, resulting in empty before/after content when get summary diff.
Changes
- use
Bun.spawnto getgit show, so it can avoidBun shellinterpretation error - add
decodeGitQuotepathto handle non-ASCII filenames (CN/KOR/JP)
Solution
Make non-ASCII filenames (CN/KOR/JP) path can be decode correctly like other filenames on Web.
Verification
Make changes to three file: test.py , 测试.py and 시험.py
Before:
- Filename is wrong and click will cause error
After: