Title: fix(fs): prevent ENOENT on subst drive root paths like "M:\\" on Windows by mag123c · Pull Request #58989 · nodejs/node · GitHub
Open Graph Title: fix(fs): prevent ENOENT on subst drive root paths like "M:\\" on Windows by mag123c · Pull Request #58989 · nodejs/node
X Title: fix(fs): prevent ENOENT on subst drive root paths like "M:\\" on Windows by mag123c · Pull Request #58989 · nodejs/node
Description: This PR fixes an issue where fs.readdirSync('M:\\') and related calls would fail with an ENOENT error on Windows when using subst drive roots. Previously, Node.js added a trailing backslash (\) even when the input path was already a drive root (e.g., M:\ or \\?\M:\), resulting in invalid paths like M:\\\. This patch introduces a check to detect standard and namespaced drive root formats and avoid appending an extra slash in those cases. The fix is Windows-specific and scoped only to the logic within fs.readdir. Changes Updated src/node_file.cc to detect and skip appending \ for drive root paths Added regression test: test/parallel/test-fs-readdir-windows-subst.js Covers subst-like paths with and without trailing slashes Verifies no ENOENT error is thrown for valid drive roots Context Fixes: #58970
Open Graph Description: This PR fixes an issue where fs.readdirSync('M:\\') and related calls would fail with an ENOENT error on Windows when using subst drive roots. Previously, Node.js added a trailing backslash...
X Description: This PR fixes an issue where fs.readdirSync('M:\\') and related calls would fail with an ENOENT error on Windows when using subst drive roots. Previously, Node.js added a trailing b...
Opengraph URL: https://github.com/nodejs/node/pull/58989
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:bcf87d56-16f4-ff93-e91a-99e6a0ca08bf |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 89C0:951F5:1021D89:1771D89:6A4CCE54 |
| html-safe-nonce | efed9736f03fbf3824ff2cf52f24e075f61e6055e7b91f3ef73e9a84aa93bd3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUMwOjk1MUY1OjEwMjFEODk6MTc3MUQ4OTo2QTRDQ0U1NCIsInZpc2l0b3JfaWQiOiIxOTQ2NjA5MDE3MTkxOTc2NTMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fe83c8c7e25963bcef07942075e713cd3dc63a147f0a4eca5671632f919d8f29 |
| hovercard-subject-tag | pull_request:2649002024 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodejs/node/pull/58989/files |
| twitter:image | https://avatars.githubusercontent.com/u/120711308?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/120711308?s=400&v=4 |
| og:image:alt | This PR fixes an issue where fs.readdirSync('M:\\') and related calls would fail with an ENOENT error on Windows when using subst drive roots. Previously, Node.js added a trailing backslash... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee8a9d18044a05fe2d57b9ae797da38c8be34effb03f015f7c42e94770d28a1b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f84814acc6f036583fd43463f5847a846243d2a4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width