Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Sosnowski <bartosz@janeasystems.com>2020-05-21 15:12:42 +0300
committerBartosz Sosnowski <bartosz@janeasystems.com>2020-05-21 15:12:42 +0300
commita4e273baf43910ba9e5c66949e56b919f8614fb9 (patch)
tree755fd4379541f736627f321ced3572a1645c8ced /lib/internal/fs
parentcd4985c488870f95488e6e7a94d280f8d7b1ecd5 (diff)
win,fs: use namespaced path in absolute symlinks
Use the namespaced (with the \\?\ prefix) paths for symlink targets when the path is absolute. This allows creation of symlinks to files with long filenames. Fixes: https://github.com/nodejs/node/issues/27795 PR-URL: https://github.com/nodejs/node/pull/33351 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/fs')
-rw-r--r--lib/internal/fs/utils.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index 96be328a8ea..b005a579338 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -302,6 +302,10 @@ function preprocessSymlinkDestination(path, type, linkPath) {
path = pathModule.resolve(linkPath, '..', path);
return pathModule.toNamespacedPath(path);
}
+ if (pathModule.isAbsolute(path)) {
+ // If the path is absolute, use the \\?\-prefix to enable long filenames
+ return pathModule.toNamespacedPath(path);
+ }
// Windows symlinks don't tolerate forward slashes.
return ('' + path).replace(/\//g, '\\');
}