ssh:// links with a drive letter on Windows remotes (#66814)
## 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.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.