mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
fix(cli): strings shouldn't be interpreted as file URLs (#6412)
This commit is contained in:
parent
70463bac7d
commit
175867ab76
2 changed files with 16 additions and 14 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue