summaryrefslogtreecommitdiff
path: root/std/path/win32.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-05-04 19:32:54 +0100
committerGitHub <noreply@github.com>2020-05-04 14:32:54 -0400
commit8c509bd88517ebc92673d9da91e71a08868e830e (patch)
tree5c880d6bafb1b5f22d69b3f1cfc52bbd4ea63056 /std/path/win32.ts
parent6c02b061ce157b9fc3d20f9bcace0bc6638290d3 (diff)
feat(URL): Support drive letters for file URLs on Windows (#5074)
refactor: Parse URLs more sequentially. This makes it easier to change matching behaviour depending on the protocol. fix: Fail when a host isn't given for certain protocols. fix: Convert back-slashes info forward-slashes.
Diffstat (limited to 'std/path/win32.ts')
-rw-r--r--std/path/win32.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/path/win32.ts b/std/path/win32.ts
index 2c262b1b6..401e572db 100644
--- a/std/path/win32.ts
+++ b/std/path/win32.ts
@@ -909,6 +909,6 @@ export function parse(path: string): ParsedPath {
*/
export function fromFileUrl(url: string | URL): string {
return new URL(url).pathname
- .replace(/^\/(?=[A-Za-z]:\/)/, "")
+ .replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/")
.replace(/\//g, "\\");
}