Skip to content

Commit 24ca937

Browse files
Capitalize drive letters in Windows paths, for consistency with Node's "path" module
1 parent 44669b8 commit 24ca937

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/util/url.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,15 @@ exports.toFileSystemPath = function toFileSystemPath (path, keepFileProtocol) {
202202
}
203203
}
204204

205-
// Step 4: On Windows, convert backslashes to forward slashes,
206-
// unless it's a "file://" URL
205+
// Step 4: Normalize Windows paths (unless it's a "file://" URL)
207206
if (isWindows && !isFileUrl) {
207+
// Replace forward slashes with backslashes
208208
path = path.replace(forwardSlashPattern, '\\');
209+
210+
// Capitalize the drive letter
211+
if (path.substr(1, 2) === ':\\') {
212+
path = path[0].toUpperCase() + path.substr(1);
213+
}
209214
}
210215

211216
return path;

0 commit comments

Comments
 (0)