Skip to content

Commit 1cc9205

Browse files
committed
Check empty input for login
Signed-off-by: hi-rustin <[email protected]>
1 parent 13ae438 commit 1cc9205

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cargo/ops/registry.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ pub fn registry_login(
749749
registry(config, token.clone(), None, reg.as_deref(), false, false)?;
750750

751751
let token = match token {
752-
Some(token) => token,
752+
Some(token) => token.trim().to_string(),
753753
None => {
754754
drop_println!(
755755
config,
@@ -767,6 +767,9 @@ pub fn registry_login(
767767
line.replace("cargo login", "").trim().to_string()
768768
}
769769
};
770+
if token.is_empty() {
771+
bail!("please provide a non-empty token");
772+
}
770773

771774
if let RegistryConfig::Token(old_token) = &reg_cfg {
772775
if old_token == &token {

0 commit comments

Comments
 (0)