Description
There are two related issues regarding how file paths are handled in the application, causing issues when files contain special characters (like #) or non-ASCII characters (like Chinese).
- Frontend Path Truncation: In
packages/app, file paths are processed as URLs. If a filename contains a # (e.g., feature#1.ts), stripQueryAndHash incorrectly interprets the part after # as a URL fragment and removes it. This results in the application looking for a truncated filename (e.g., feature) which does not exist.
- Backend Git Path Parsing: In
packages/opencode, the git diff and git show commands output filenames with non-ASCII or special characters in a quoted, octal-escaped format (e.g., "\344\270\255\226\207.ts"). The current snapshot logic does not decode these paths, leading to ENOENT errors when trying to retrieve file content or diffs.
Plugins
No response
OpenCode version
v1.1.28
Steps to reproduce
- Initialize the project and start the dev server.
- Create a file with a
# in the name, e.g., styles/main#v2.css.
- Create a file with Chinese characters, e.g.,
docs/说明.md.
- Stage or commit these files.
- Open the Session Review or Diff View pane.
- Click on the files to view the diff.
Expected behavior: The diff should load and display the file content correctly.
Actual behavior:
- For
styles/main#v2.css: The file might fail to open, or show empty content, because the request path is truncated to styles/main.
- For
docs/说明.md: The diff shows empty "Before" and "After" content because the backend failed to resolve the escaped path "\344\270...".
Screenshot and/or share link
Operating System
macOS
Terminal
No response
Description
There are two related issues regarding how file paths are handled in the application, causing issues when files contain special characters (like
#) or non-ASCII characters (like Chinese).packages/app, file paths are processed as URLs. If a filename contains a#(e.g.,feature#1.ts),stripQueryAndHashincorrectly interprets the part after#as a URL fragment and removes it. This results in the application looking for a truncated filename (e.g.,feature) which does not exist.packages/opencode, thegit diffandgit showcommands output filenames with non-ASCII or special characters in a quoted, octal-escaped format (e.g.,"\344\270\255\226\207.ts"). The current snapshot logic does not decode these paths, leading toENOENTerrors when trying to retrieve file content or diffs.Plugins
No response
OpenCode version
v1.1.28
Steps to reproduce
#in the name, e.g.,styles/main#v2.css.docs/说明.md.Expected behavior: The diff should load and display the file content correctly.
Actual behavior:
styles/main#v2.css: The file might fail to open, or show empty content, because the request path is truncated tostyles/main.docs/说明.md: The diff shows empty "Before" and "After" content because the backend failed to resolve the escaped path"\344\270...".Screenshot and/or share link
Operating System
macOS
Terminal
No response