Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ async function resolveSymlinks(filepath: string): Promise<string> {
let skipCount = 1; // Skip first segment by default

// Handle the root segment differently for Windows vs POSIX
if (path.win32.isAbsolute(filepath)) {
// Check POSIX first: path.win32.isAbsolute() returns true for
// POSIX absolute paths (leading "/" is the current drive root in
// Win32), so checking it first would incorrectly push an empty
// string instead of "/" on Linux/macOS/WSL, producing a relative
// path that causes realpath to prepend CWD repeatedly.
if (path.posix.isAbsolute(filepath)) {
resolvedParts.push("/");
} else if (path.win32.isAbsolute(filepath)) {
resolvedParts.push(parts[0]);
if (parts[1] === "") {
resolvedParts.push("");
skipCount = 2; // Skip two segments for UNC paths
}
} else if (path.posix.isAbsolute(filepath)) {
resolvedParts.push("/");
} else {
resolvedParts.push(parts[0]);
}
Expand Down