summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorMasahiro Miyashiro (3846masa) <3846masahiro@gmail.com>2020-05-18 00:37:16 +0900
committerGitHub <noreply@github.com>2020-05-17 11:37:16 -0400
commit63bc468365bceda929a39b5eb93b605e2dc2bd9c (patch)
tree3293c6bf478c29fb92dc7890936fc46199b8907d /std
parent4db4a7fbccad698a1e91ea0c9b6c9a68c2d553f7 (diff)
Fix definition of URL constructor (#5521)
Diffstat (limited to 'std')
-rw-r--r--std/path/posix.ts2
-rw-r--r--std/path/win32.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/std/path/posix.ts b/std/path/posix.ts
index e88eb3f97..981d32a8c 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -430,5 +430,5 @@ export function parse(path: string): ParsedPath {
* are ignored.
*/
export function fromFileUrl(url: string | URL): string {
- return new URL(url).pathname;
+ return new URL(url.toString()).pathname;
}
diff --git a/std/path/win32.ts b/std/path/win32.ts
index 0557b3768..eafddd138 100644
--- a/std/path/win32.ts
+++ b/std/path/win32.ts
@@ -908,7 +908,7 @@ export function parse(path: string): ParsedPath {
* are ignored.
*/
export function fromFileUrl(url: string | URL): string {
- return new URL(url).pathname
+ return new URL(url.toString()).pathname
.replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/")
.replace(/\//g, "\\");
}