Skip to content

File paths with special characters (#) or non-ASCII characters fail to load in Diff/Review view #9804

Description

@shirukai

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).

  1. 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.
  2. 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

  1. Initialize the project and start the dev server.
  2. Create a file with a # in the name, e.g., styles/main#v2.css.
  3. Create a file with Chinese characters, e.g., docs/说明.md.
  4. Stage or commit these files.
  5. Open the Session Review or Diff View pane.
  6. 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

Image Image

Operating System

macOS

Terminal

No response

Activity

  1. github-actions commented on Jan 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These issues describe the same root cause: improper handling of special characters and non-ASCII characters in file paths, affecting both the frontend (CSS selector escaping, URL fragment handling) and backend (git path parsing).

    Feel free to ignore if these don't address your specific case.

  2. added 4 commits that reference this issue on Feb 3, 2026
    51ee6a0
    0b86aeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions