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:
authorEvan Lucas <evanlucas@me.com>2016-03-07 19:31:14 +0300
committerEvan Lucas <evanlucas@me.com>2016-03-07 23:48:49 +0300
commit3d3b45ae958f5bfc8cfdbdb30bcfd512a18740af (patch)
tree5c7ff9af45484cc458f51566e943296d727491ec /lib/path.js
parent1d9a2b28bb1388c6086a14d63c142c466d60057e (diff)
path: fix normalize for absolutes
Fixes a regression introduced by b212be08f62a48656c5befd8be0a82d691ea66e4. path.normalize(''/a/b/c/../../../x/y/z'') should return '/x/y/z'. Fixes: https://github.com/nodejs/node/issues/5585 PR-URL: https://github.com/nodejs/node/pull/5589 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib/path.js')
-rw-r--r--lib/path.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/path.js b/lib/path.js
index 1c5d9a92e53..64e34ecde66 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -44,7 +44,7 @@ function normalizeStringWin32(path, allowAboveRoot) {
dots = 0;
continue;
}
- } else if (res.length === 2) {
+ } else if (res.length === 2 || res.length === 1) {
res = '';
lastSlash = i;
dots = 0;
@@ -110,7 +110,7 @@ function normalizeStringPosix(path, allowAboveRoot) {
dots = 0;
continue;
}
- } else if (res.length === 2) {
+ } else if (res.length === 2 || res.length === 1) {
res = '';
lastSlash = i;
dots = 0;