diff --git a/lib/path.js b/lib/path.js index 8b08496b48e9fe..896ef7335c7307 100644 --- a/lib/path.js +++ b/lib/path.js @@ -58,7 +58,7 @@ function normalizeArray(parts, allowAboveRoot) { // Regex to split a windows path into three parts: [*, device, slash, // tail] windows-only var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + /^(?:\.\.[\\\/]|\.[\\\/])*([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; // Regex to split the tail part of the above into [*, dir, basename, ext] var splitTailRe = diff --git a/test/simple/test-path-parse-format.js b/test/simple/test-path-parse-format.js index 4f6e5af45c06e8..7a1b7883b8a78d 100644 --- a/test/simple/test-path-parse-format.js +++ b/test/simple/test-path-parse-format.js @@ -28,7 +28,6 @@ var winPaths = [ 'another_path\\DIR with spaces\\1\\2\\33\\index', '\\foo\\C:', 'file', - '.\\file', // unc '\\\\server\\share\\file_path', diff --git a/test/simple/test-path.js b/test/simple/test-path.js index cdd59bcd5d93ec..11542036e8c90b 100644 --- a/test/simple/test-path.js +++ b/test/simple/test-path.js @@ -317,7 +317,8 @@ if (isWindows) { [['c:/', '//dir'], 'c:\\dir'], [['c:/', '//server/share'], '\\\\server\\share\\'], [['c:/', '//server//share'], '\\\\server\\share\\'], - [['c:/', '///some//dir'], 'c:\\some\\dir'] + [['c:/', '///some//dir'], 'c:\\some\\dir'], + [['c:/some/random/path', '../../../../../d:/some/dir'], 'd:\\some\\dir'] ]; } else { // Posix