Skip to content

fix(tui): decode percent-encoded file URIs in initial prompts#15559

Open
ca0fgh wants to merge 5 commits intoanomalyco:devfrom
ca0fgh:fix/tui-decode-file-uri-display
Open

fix(tui): decode percent-encoded file URIs in initial prompts#15559
ca0fgh wants to merge 5 commits intoanomalyco:devfrom
ca0fgh:fix/tui-decode-file-uri-display

Conversation

@ca0fgh
Copy link

@ca0fgh ca0fgh commented Mar 1, 2026

Issue for this PR

Closes #15561

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes percent-encoded file:// path rendering in TUI initial prompts.

  • Adds decodeFileUriForDisplay and decodeFileUrisInText to packages/util/src/path.ts.
  • Decodes percent-encoded Unicode path segments (for display only) while preserving query/hash.
  • Applies decode at TUI prompt hydration points:
    • packages/opencode/src/cli/cmd/tui/routes/home.tsx
    • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
  • Guardrail: only decodes when initialPrompt.parts.length === 0 to avoid shifting extmark/source offsets for prompts that include structured parts.

How did you verify your code works?

  • Ran:
    • bun run typecheck in packages/util
    • bun run typecheck in packages/opencode
  • Reproduced with a path containing Chinese characters (for example 测评):
    • before: file:///.../%E6%B5%8B%E8%AF%84/...
    • after: file:///.../测评/...

Screenshots / recordings

N/A (TUI text rendering fix)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Mar 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Mar 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: percent-encoded non-ASCII file URIs are shown encoded in initial prompts

1 participant