1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00

Fix definition of URL constructor (#6653)

This commit is contained in:
Ryan Dahl 2020-07-06 17:39:13 -04:00 committed by GitHub
parent dbc2372cde
commit 5c43131be1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -1236,7 +1236,7 @@ interface URL {
declare const URL: { declare const URL: {
prototype: URL; prototype: URL;
new (url: string | URL, base?: string | URL): URL; new (url: string, base?: string | URL): URL;
createObjectURL(object: any): string; createObjectURL(object: any): string;
revokeObjectURL(url: string): void; revokeObjectURL(url: string): void;
}; };

View file

@ -435,5 +435,5 @@ export function parse(path: string): ParsedPath {
* are ignored. * are ignored.
*/ */
export function fromFileUrl(url: string | URL): string { export function fromFileUrl(url: string | URL): string {
return new URL(url).pathname; return new URL(String(url)).pathname;
} }

View file

@ -914,7 +914,7 @@ export function parse(path: string): ParsedPath {
* are ignored. * are ignored.
*/ */
export function fromFileUrl(url: string | URL): string { export function fromFileUrl(url: string | URL): string {
return new URL(url).pathname return new URL(String(url)).pathname
.replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/") .replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/")
.replace(/\//g, "\\"); .replace(/\//g, "\\");
} }