Skip to content

Fix "invalid path" error for UNC paths on Windows - #1277

Open
hamodywe wants to merge 1 commit into
ajeetdsouza:mainfrom
hamodywe:fix/windows-unc-path-resolution
Open

Fix "invalid path" error for UNC paths on Windows#1277
hamodywe wants to merge 1 commit into
ajeetdsouza:mainfrom
hamodywe:fix/windows-unc-path-resolution

Conversation

@hamodywe

@hamodywe hamodywe commented Aug 8, 2026

Copy link
Copy Markdown

resolve_path() only handled Prefix::Disk and Prefix::VerbatimDisk when initializing the path root on Windows, so any UNC path (\server\share, or its ?\UNC\server\share verbatim form) fell through to the catch-all branch and errored with "invalid path", even though the path itself was perfectly valid. This broke zoxide entirely for anyone whose directories live on a network share.

Add a Prefix::UNC / Prefix::VerbatimUNC arm that builds the \server\share root the same way the Disk arms build their drive root, and add resolve_path unit tests covering UNC, verbatim UNC, and a disk-path regression check.

Fixes #331

resolve_path() only handled Prefix::Disk and Prefix::VerbatimDisk when
initializing the path root on Windows, so any UNC path (\server\share,
or its \?\UNC\server\share verbatim form) fell through to the
catch-all branch and errored with "invalid path", even though the path
itself was perfectly valid. This broke zoxide entirely for anyone whose
directories live on a network share.

Add a Prefix::UNC / Prefix::VerbatimUNC arm that builds the \server\share
root the same way the Disk arms build their drive root, and add
resolve_path unit tests covering UNC, verbatim UNC, and a disk-path
regression check.

Fixes ajeetdsouza#331
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.

could not get drive letter: \\a.network-drive\a-folder

1 participant