# Windows: Fix files opened by UNC path getting no language servers \(\#56553\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/a51d23c93d15cf04c5d5cae2ecbf5b71404b71b7)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: a51d23c93d15cf04c5d5cae2ecbf5b71404b71b7

Requested commit: a51d23c93d15cf04c5d5cae2ecbf5b71404b71b7

Commit: a51d23c93d15cf04c5d5cae2ecbf5b71404b71b7

Tree: 0c030e0dfc7b3130b8bbf507a7248f11e43e603b

Author: Joblen

Committer: GitHub

## Message

```
Windows: Fix files opened by UNC path getting no language servers (#56553)

Opening a file like `zed "\\server\share\file.txt"` leaves it with no
language servers attached, and the tab shows the ugly `\\?\UNC\...`
path.

The problem is the verbatim `\\?\UNC\` prefix Windows adds during path
canonicalization. We rely on dunce to strip these prefixes, but it
doesn't handle the UNC case, so the path stays in a form that breaks LSP
URL conversion.

Fixed by stripping the prefix ourselves in `SanitizedPath` before
handing off to dunce.

Before:
<img width="446" height="257" alt="Screenshot 2026-06-12 075128"
src="https://github.com/user-attachments/assets/4177e8de-8d13-42f1-a19b-d7dd52c10b32"
/>

After: (note the correct tooltip and the syntax error highlighting)
<img width="423" height="268" alt="Screenshot 2026-06-12 083651"
src="https://github.com/user-attachments/assets/83e98200-6bed-4a9e-b463-abbc067f6a5d"
/>

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
— N/A, no UI changes
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable — one
extra string-prefix check per worktree creation

Release Notes:

- Fixed: language servers now run when opening files via UNC paths on
Windows (e.g. `\\server\share\file.txt`).

---------

Co-authored-by: Chris Biscardi <chris@christopherbiscardi.com>
```

## Parents

- [395def7a067b32ed598fcb3f048969ada9b54942](https://git.cafe/gitcafe/zed/commit/395def7a067b32ed598fcb3f048969ada9b54942?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/a51d23c93d15cf04c5d5cae2ecbf5b71404b71b7?format=markdown)
