summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index 9fc657c26..76ad50211 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -941,7 +941,7 @@ The executable name is inferred by default:
and the path has no parent, take the file name of the parent path. Otherwise
settle with the generic name.
- If the resulting name has an '@...' suffix, strip it.
-
+
This commands supports cross-compiling to different target architectures using `--target` flag.
On the first invocation with deno will download proper binary and cache it in $DENO_DIR. The
aarch64-apple-darwin target is not supported in canary.
@@ -1475,11 +1475,11 @@ fn location_arg<'a, 'b>() -> Arg<'a, 'b> {
return Err("Failed to parse URL".to_string());
}
let mut url = url.unwrap();
- url.set_username("").unwrap();
- url.set_password(None).unwrap();
if !["http", "https"].contains(&url.scheme()) {
return Err("Expected protocol \"http\" or \"https\"".to_string());
}
+ url.set_username("").unwrap();
+ url.set_password(None).unwrap();
Ok(())
})
.help("Value of 'globalThis.location' used by some web APIs")
@@ -3411,4 +3411,15 @@ mod tests {
}
);
}
+
+ #[test]
+ fn location_with_bad_scheme() {
+ #[rustfmt::skip]
+ let r = flags_from_vec(svec!["deno", "run", "--location", "foo:", "mod.ts"]);
+ assert!(r.is_err());
+ assert!(r
+ .unwrap_err()
+ .to_string()
+ .contains("Expected protocol \"http\" or \"https\""));
+ }
}