win: fix fs.realpath.native for long paths
Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: https://github.com/nodejs/node/issues/39721 PR-URL: https://github.com/nodejs/node/pull/44536 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
This commit is contained in:
parent
050a1451e9
commit
8b50160612
@ -2600,7 +2600,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;
|
||||
};
|
||||
@ -2760,7 +2760,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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user