Skip to content

Copilot/handle extended path on windows#1

Merged
jazelly merged 2 commits intofix-62446from
copilot/handle-extended-path-on-windows
Mar 31, 2026
Merged

Copilot/handle extended path on windows#1
jazelly merged 2 commits intofix-62446from
copilot/handle-extended-path-on-windows

Conversation

@jazelly
Copy link
Copy Markdown
Owner

@jazelly jazelly commented Mar 31, 2026


Note

Medium Risk
Touches core path canonicalization logic in fs.realpath* on Windows, which could impact edge-case path handling and caching behavior despite being narrowly scoped and covered by a new regression test.

Overview
fs.realpathSync() and fs.realpath() now normalize Windows extended-length paths by stripping the \\?\ prefix (including \\?\C:\... and \\?\UNC\...) before the internal path-walking/symlink-resolution logic runs, and re-strip after path.resolve() when symlink targets are recomputed.

Adds a Windows-only regression test covering extended-length file paths, drive roots, and subdirectory paths to ensure realpath returns standard (non-namespaced) paths.

Written by Cursor Bugbot for commit 4a66705. This will update automatically on new commits. Configure here.

Copilot AI and others added 2 commits March 27, 2026 06:27
Strip the \\?\ extended-length path prefix from Windows paths in
fs.realpathSync and fs.realpath before the path walking logic.

The \\?\ prefix is a Win32 API mechanism to bypass MAX_PATH limits.
When a user passes a path like \\?\C:\path\to\file.js, Node.js should
handle it transparently by converting to the standard C:\path\to\file.js
form for internal processing. The \\?\ prefix is re-added as needed via
path.toNamespacedPath() before actual system calls.

Handles two forms of extended paths:
- \\?\C:\path -> C:\path (extended drive path)
- \\?\UNC\server\share -> \\server\share (extended UNC path)

Fixes: nodejs#62446

Agent-Logs-Url: https://github.com/jazelly/node/sessions/77c338e9-ef46-46f1-8800-b6ad9a74ab36

Co-authored-by: jazelly <28685065+jazelly@users.noreply.github.com>
@jazelly jazelly merged commit 4f76d57 into fix-62446 Mar 31, 2026
22 of 23 checks passed
@jazelly jazelly deleted the copilot/handle-extended-path-on-windows branch April 8, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants