[PR #7757] fix(webUI): handle non-ASCII filenames in snapshot diff #12503

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

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

State: open
Merged: No


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.spawn to get git show, so it can avoid Bun shell interpretation error
  • add decodeGitQuotepath to 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
    Before1
    Before2

After:
After

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7757 **State:** open **Merged:** No --- # 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.spawn` to get `git show`, so it can avoid `Bun shell` interpretation error - add `decodeGitQuotepath` to 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 <img width="2988" height="1886" alt="Before1" src="https://github.com/user-attachments/assets/abb53e85-c9cd-4d84-8a4c-2605fdee05b5" /> <img width="2984" height="1888" alt="Before2" src="https://github.com/user-attachments/assets/c639bc7c-e839-457c-9dc9-6f2178fbc81b" /> After: <img width="3008" height="1872" alt="After" src="https://github.com/user-attachments/assets/f843fd00-753c-4605-8d03-1dcfa3bff71b" />
yindo added the pull-request label 2026-02-16 18:17:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12503