Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for path.resolve containing relative path to another drive in windows #57

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 0 additions & 1 deletion test/simple/test-path-parse-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var winPaths = [
'another_path\\DIR with spaces\\1\\2\\33\\index',
'\\foo\\C:',
'file',
'.\\file',

// unc
'\\\\server\\share\\file_path',
Expand Down
3 changes: 2 additions & 1 deletion test/simple/test-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down