[BUG] VS Code extension: file links with spaces or non-ASCII characters don't open (openFile() never decodes the percent-encoded path)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
File links that Claude writes in the chat panel render as clickable, but clicking them does nothing when the path contains a space or a non-ASCII character (é, ç, ó, CJK...). ASCII-only paths without spaces are not affected.
The click does reach the extension: it posts an open_file request, but filePath is still percent-encoded (Client%20Files/Relat%C3%B3rios/report.html). openFile() in extension.js treats that string as a literal filesystem path and never decodes it:
async openFile($,Q){let J=A6.isAbsolute($)?$:A6.join(this.cwd,$); ... let X=_$.Uri.file(J); ...
path.join keeps %20 literally, the file doesn't exist, the fuzzy-search fallback finds nothing, and Uri.file() encodes the % a second time (%2520), so VS Code reports "Unable to read file".
For anyone whose folders have spaces or accents (most non-English users), file links almost never work.
What Should Happen?
Clicking the link opens the file in the editor (or, for a folder link, reveals it in the Explorer, which openFile() already does for directories), regardless of spaces or non-ASCII characters in the path.
Error Messages/Logs
Claude VSCode.log (the click reaches the extension, path still encoded):
Received message from webview: {"type":"request","request":{"type":"open_file","filePath":"Client%20Files/Relat%C3%B3rios/report.html","location":{}}}
exthost.log / renderer.log (the path gets encoded a second time; note the real workspace space stays %20 while the link's space becomes %2520):
CodeExpectedError: cannot open file:///Users/<user>/My%20Project/Client%2520Files/Relat%25C3%25B3rios/report.html. Detail: Unable to read file
Steps to Reproduce
- Open a workspace that contains the file "Client Files/Relatórios/report.html".
- Have Claude reply with a link to it. All of these forms fail:
- [report.html](<Client Files/Relatórios/report.html>)
- [report.html](Client%20Files/Relat%C3%B3rios/report.html)
- [folder](<Client Files/Relatórios/>)
- Click the link in the chat panel. Nothing opens, and the logs above appear.
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.266
Platform
Other
Operating System
macOS
Terminal/Shell
Other
Additional Information
Suggested fix: decode the path before resolving it (or decode in the webview before posting open_file), guarded so real filenames that contain "%" keep working:
if (!fs.existsSync(path.isAbsolute(p) ? p : path.join(this.cwd, p))) {
try { p = decodeURIComponent(p) } catch {}
}
I checked that openFile() does no decoding in both 2.1.169 (VS Code) and 2.1.266 (Antigravity IDE).
Probably the same root cause as #48892, #51048 and #51489 (non-ASCII paths), all closed without a root cause, so I'm filing again with the exact location and a fix.
Also noticed: file:// links and custom-scheme links in the chat panel are ignored entirely (no message reaches the extension).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗