From 175867ab763a96f591b65386f09a385b87b399ab Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Fri, 26 Jun 2020 20:29:34 +0800 Subject: fix(cli): strings shouldn't be interpreted as file URLs (#6412) --- cli/js/util.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'cli/js/util.ts') diff --git a/cli/js/util.ts b/cli/js/util.ts index a67dec595..d68a6cb51 100644 --- a/cli/js/util.ts +++ b/cli/js/util.ts @@ -110,14 +110,9 @@ function pathFromURLPosix(url: URL): string { } export function pathFromURL(pathOrUrl: string | URL): string { - if (typeof pathOrUrl == "string") { - try { - pathOrUrl = new URL(pathOrUrl); - } catch {} - } if (pathOrUrl instanceof URL) { if (pathOrUrl.protocol != "file:") { - throw new TypeError("Must be a path string or file URL."); + throw new TypeError("Must be a file URL."); } return build.os == "windows" -- cgit v1.2.3