Skip to content

fix(file): strip Windows verbatim prefix from /api/fs/browse paths#453

Merged
piorpua merged 1 commit into
mainfrom
fix/browse-verbatim-paths
Jun 11, 2026
Merged

fix(file): strip Windows verbatim prefix from /api/fs/browse paths#453
piorpua merged 1 commit into
mainfrom
fix/browse-verbatim-paths

Conversation

@lornestack

Copy link
Copy Markdown
Contributor

Problem

iOfficeAI/AionUi#3191 — on Windows, selecting a directory in the WebUI picker stores paths like \\?\C:\DEV\xxxxx as the conversation workspace. Claude Code then fails to connect (cmd.exe-based CLI shims reject verbatim working directories), and the same directory shows up as two different projects in the sidebar (C:\DEV\xxxxx from old sessions vs \\?\C:\DEV\xxxxx from new ones).

Root cause

The /api/fs/browse endpoint (added in #235, replacing the legacy Express implementation in AionUi) resolves paths with fs::canonicalize, which on Windows returns extended-length (verbatim) paths — \\?\C:\DEV. Those strings were serialized verbatim into current_path, parent_path and every item path. The legacy Express endpoint built paths with Node's path.join and never produced this form, so this is an M6-cutover regression.

Fix

Strip \\?\ (and \\?\UNC\\\) at the response-serialization boundary in browse.rs. Internal sandbox checks keep comparing canonical (verbatim) forms, so the allow-list semantics are unchanged.

Tests

  • Cross-platform string-level unit tests for the strip helper (covered by Linux CI)
  • #[cfg(windows)] end-to-end regression test asserting no response path carries the verbatim prefix (fails on Windows without this fix)
  • cargo test full workspace: 6022 passed; clippy -D warnings + fmt clean

Frontend defensive counterpart: iOfficeAI/AionUi PR (renderer-side normalization for older backend binaries) follows.

Fixes iOfficeAI/AionUi#3191

fs::canonicalize returns extended-length (verbatim) paths on Windows
(\\?\C:\DEV), which the endpoint serialized verbatim into current_path,
parent_path and item paths. The WebUI stored that string as the
conversation workspace, breaking Claude Code spawning (cmd.exe shims
reject verbatim working directories) and splitting the same directory
into two project-list entries.

Strip \\?\ and \\?\UNC\ prefixes at the response boundary; sandbox
checks keep comparing canonical (verbatim) forms internally.

Fixes iOfficeAI/AionUi#3191
@piorpua piorpua merged commit f8c3f95 into main Jun 11, 2026
6 checks passed
@piorpua piorpua deleted the fix/browse-verbatim-paths branch June 11, 2026 12:55
piorpua pushed a commit that referenced this pull request Jun 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.28](v0.1.27...v0.1.28)
(2026-06-11)


### Bug Fixes

* **auth:** allow same-origin framing on office preview proxy routes
([#454](#454))
([3543dbd](3543dbd))
* **file:** strip Windows verbatim prefix from /api/fs/browse paths
([#453](#453))
([f8c3f95](f8c3f95))
* **stt:** STT compatibility fixes for Groq Whisper and AionUI web
frontend ([#400](#400))
([4c3fa09](4c3fa09))
* **stt:** treat blank base_url as unset and log malformed config
([#448](#448))
([f6b653b](f6b653b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

[Bug]: Web端选择项目路径后,似乎项目路径异常导致无法连接claude code?

2 participants