mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
73ad8e3ed0
## Summary Closes #66813 `ssh://host/C:/project` (and `zed://ssh/host/C:/...`) sends `/C:/project` to the remote, because a URL path keeps a `/` before a Windows drive letter. A Windows remote server cannot canonicalize that path (os error 123), so the project fails to open with `DevServerProjectPathDoesNotExist`. This is a follow-up to #66497, which fixed the same leading `/` for local `file://` and `zed://file` links. That fix could not be reused here: it checks the local OS while the URL is parsed, and for SSH the remote's OS is only known after connecting. This change strips the slash in `determine_paths_with_positions`, which runs after the connection and can ask the remote for its path style. Paths on Unix remotes and `/~` paths are left alone. Before (Zed 1.27.0): <img width="420" height="225" alt="zed-ssh-drive-letter-error" src="https://github.com/user-attachments/assets/ee33b4e7-4dae-43a1-8bfa-8b85c8302ebe" /> After (this branch, same URL): <img width="620" height="140" alt="zed-ssh-drive-letter-fixed" src="https://github.com/user-attachments/assets/a937839c-f8ba-4f2e-9fb0-9ca1a91380be" /> ## Testing - Windows 11 Pro with OpenSSH Server, connected to itself over `localhost` (setup in #66813). - Zed 1.27.0: `zed ssh://zed-win-repro/C:/Users/<user>/zed-ssh-repro/project` fails with `DevServerProjectPathDoesNotExist path=/C:/...`. - This branch, debug build, with the remote server built from the same commit: the same URL opens the project, and the worktree is `C:\Users\<user>\zed-ssh-repro\project`. - `cargo test -p recent_projects --lib remote_connections`: 6 passed, including the new `test_strip_slash_before_drive_letter`, which covers both path styles and the paths that must stay unchanged. - `cargo clippy -p recent_projects --tests`: no warnings. To test a debug build against a Windows remote: the debug remote server panics outside the checkout ("dev asset loading requires running from within the checkout"), so build it with `cargo build -p remote_server --features util/debug-embed` and set `ZED_COPY_REMOTE_SERVER` to `target/debug/remote-server.exe`. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). (No UI changes.) - [x] Tests cover the new or changed behavior. Release Notes: - Fixed `ssh://` links with a drive letter (for example `ssh://user@host/C:/project`) failing to open a project on a Windows remote.