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:
-rw-r--r--lib/path.js4
-rw-r--r--test/parallel/test-path.js3
2 files changed, 5 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;
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js
index fce54a52fb3..eb49360defd 100644
--- a/test/parallel/test-path.js
+++ b/test/parallel/test-path.js
@@ -377,6 +377,7 @@ assert.equal(path.win32.normalize('a//b//./c'), 'a\\b\\c');
assert.equal(path.win32.normalize('a//b//.'), 'a\\b');
assert.equal(path.win32.normalize('//server/share/dir/file.ext'),
'\\\\server\\share\\dir\\file.ext');
+assert.equal(path.win32.normalize('/a/b/c/../../../x/y/z'), '\\x\\y\\z');
assert.equal(path.posix.normalize('./fixtures///b/../b/c.js'),
'fixtures/b/c.js');
@@ -384,6 +385,8 @@ assert.equal(path.posix.normalize('/foo/../../../bar'), '/bar');
assert.equal(path.posix.normalize('a//b//../b'), 'a/b');
assert.equal(path.posix.normalize('a//b//./c'), 'a/b/c');
assert.equal(path.posix.normalize('a//b//.'), 'a/b');
+assert.equal(path.posix.normalize('/a/b/c/../../../x/y/z'), '/x/y/z');
+assert.equal(path.posix.normalize('///..//./foo/.//bar'), '/foo/bar');
// path.resolve tests