Fix definition of URL constructor (#5521)

This commit is contained in:
Masahiro Miyashiro (3846masa) 2020-05-18 00:37:16 +09:00 committed by GitHub
parent 4db4a7fbcc
commit 63bc468365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -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, "\\");
}