You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows UNC file URLs are not resolved or generated correctly #744
On Windows, file: URLs are handled by string surgery against a fixed file:/// prefix, so UNC paths — network shares, mapped drives — do not round trip.
A valid UNC file URL is file://server/share/dir/module.ts — two slashes, with the host in the authority component. It does not start with file:///, so:
Parsing.create_resolve strips PATH_PREFIX from parentURL to find the directory to resolve from. For a UNC parent the prefix does not match and resolution fails outright:
Error: Parent URL is not a file URL
Generating.oxc_resolved_path_to_url replaces backslashes with forward slashes and concatenates onto file:///, so \\server\share\x.ts becomes
file://///server/share/x.ts # produced
file://server/share/x.ts # what pathToFileURL() gives
The host is lost and the slash count is wrong, so Node.js reads it back as a different path.
Impact
Projects loaded from a Windows network share, or from a UNC path that was not mapped to a drive letter, and any module graph entered through a UNC URL. Ordinary drive-letter paths (C:\...) are unaffected — file:///C:/... matches the prefix and round trips correctly, which is why the existing Windows CI jobs pass.
a path starting with \\ becomes file://<host>/<share>/..., with the host percent-encoded as an authority
everything else keeps file:///<drive>:/...
when parsing, a non-empty authority maps back to \\<host>\...
Worth covering with a fixture built on a UNC path in the Windows CI jobs, since a
drive-letter fixture cannot catch this.
Notes
Found while working on #633 but unrelated to it; the behaviour is the same on main. I do not have a Windows machine to verify a fix on, so I have not attempted one rather than guess at it.
Activity
fix: handle Windows UNC file URLs (#744)
fix: handle Windows UNC file URLs (oxc-project#744) (oxc-project#760)
test: remove four file URL tests that stronger tests cover (#904)