Don't canonicalize roots — \\?\UNC\... prefix breaks downstream Path ops

This commit is contained in:
megaproxy 2026-05-09 01:15:58 +01:00
parent 9d10c1f46f
commit c5c38d1ce5

View file

@ -137,13 +137,14 @@ pub fn resolve_roots(
}
}
// Canonicalize + dedupe. canonicalize() can fail on UNC paths on some
// Windows builds; if so, fall back to the raw path so we don't drop hits.
// Dedup raw — DO NOT canonicalize. On Windows, canonicalize() rewrites
// `\\wsl$\...` to `\\?\UNC\wsl$\...` (NT-namespace form), and `Path`
// operations like `.parent()` and `.join()` get inconsistent on that
// prefix, breaking downstream lookups (e.g. tier detection).
let mut canon: Vec<PathBuf> = Vec::new();
for p in roots {
let c = std::fs::canonicalize(&p).unwrap_or(p);
if !canon.contains(&c) {
canon.push(c);
if !canon.contains(&p) {
canon.push(p);
}
}