Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win: fix fs.realpath.native for long paths #44536

Merged
merged 1 commit into from Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fs.js
Expand Up @@ -2612,7 +2612,7 @@ realpathSync.native = (path, options) => {
options = getOptions(options);
path = getValidatedPath(path);
const ctx = { path };
const result = binding.realpath(path, options.encoding, undefined, ctx);
const result = binding.realpath(pathModule.toNamespacedPath(path), options.encoding, undefined, ctx);
handleErrorFromBinding(ctx);
return result;
};
Expand Down Expand Up @@ -2772,7 +2772,7 @@ realpath.native = (path, options, callback) => {
path = getValidatedPath(path);
const req = new FSReqCallback();
req.oncomplete = callback;
return binding.realpath(path, options.encoding, req);
return binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
};

/**
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-fs-long-path.js
Expand Up @@ -43,4 +43,7 @@ console.log({

fs.writeFile(fullPath, 'ok', common.mustSucceed(() => {
fs.stat(fullPath, common.mustSucceed());

// Tests https://github.com/nodejs/node/issues/39721
fs.realpath.native(fullPath, common.mustSucceed());
}));