mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
fs: fix fs.promises.realpath for long paths on Windows
Unlike other fs functions that work with paths, realpath 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/51031 PR-URL: https://github.com/nodejs/node/pull/51032 Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
4560834446
commit
4944e971bb
@ -1160,7 +1160,7 @@ async function realpath(path, options) {
|
||||
options = getOptions(options);
|
||||
path = getValidatedPath(path);
|
||||
return await PromisePrototypeThen(
|
||||
binding.realpath(path, options.encoding, kUsePromises),
|
||||
binding.realpath(pathModule.toNamespacedPath(path), options.encoding, kUsePromises),
|
||||
undefined,
|
||||
handleErrorFromBinding,
|
||||
);
|
||||
|
@ -46,4 +46,7 @@ fs.writeFile(fullPath, 'ok', common.mustSucceed(() => {
|
||||
|
||||
// Tests https://github.com/nodejs/node/issues/39721
|
||||
fs.realpath.native(fullPath, common.mustSucceed());
|
||||
|
||||
// Tests https://github.com/nodejs/node/issues/51031
|
||||
fs.promises.realpath(fullPath).then(common.mustCall(), common.mustNotCall());
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user