summaryrefslogtreecommitdiff
path: root/cli/js/util.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-06-26 20:29:34 +0800
committerGitHub <noreply@github.com>2020-06-26 08:29:34 -0400
commit175867ab763a96f591b65386f09a385b87b399ab (patch)
treea30527457f2a9d53c5700657fec5bbcf07b570bf /cli/js/util.ts
parent70463bac7d0327027f4650e3b4ab810e76604e2b (diff)
fix(cli): strings shouldn't be interpreted as file URLs (#6412)
Diffstat (limited to 'cli/js/util.ts')
-rw-r--r--cli/js/util.ts7
1 files changed, 1 insertions, 6 deletions
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"