fix(fs): prevent ENOENT on subst drive root paths like "M:\\" on Windows by mag123c · Pull Request #58989 · nodejs/node

@nodejs-github-bot added c++

Issues and PRs that require attention from people who are familiar with C++.

fs

Issues and PRs related to the fs subsystem / file system.

needs-ci

PRs that need a full CI run.

labels

Jul 8, 2025

@mag123c

When using fs.readdir() or fs.readdirSync() on subst drive root paths
such as M:\, Node.js was incorrectly adding a second backslash,
resulting in M:\\, which caused ENOENT errors on Windows.

This patch adds a safeguard to avoid appending a backslash if the path
already represents a drive root, including both standard (e.g. C:\)
and namespaced (e.g. \\?\C:\) formats.

Fixes: nodejs#58970

@github-actions github-actions bot added request-ci-failed

An error occurred while starting CI via request-ci label, and manual interventon is needed.

and removed request-ci

Add this label to start a Jenkins CI on a PR.

labels

Jul 22, 2025

StefanStojanovic

@mag123c