Skip to content

Commit

Permalink
Check empty input for login
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
  • Loading branch information
Rustin170506 committed Sep 26, 2022
1 parent 13ae438 commit 73a8c1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,11 @@ pub fn registry_login(
.with_context(|| "failed to read stdin")?;
// Automatically remove `cargo login` from an inputted token to
// allow direct pastes from `registry.host()`/me.
line.replace("cargo login", "").trim().to_string()
line.replace("cargo login", "").trim().to_string();
if line.is_empty() {
bail!("please provide a non-empty token");
}
line
}
};

Expand Down

0 comments on commit 73a8c1b

Please sign in to comment.