From c7cb72a77a213c709ef09d3021b7c310621fb0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 5 Jun 2025 10:59:06 +0200 Subject: [PATCH] Make sure we skip empty prompted emails --- crates/meilisearch/src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/meilisearch/src/main.rs b/crates/meilisearch/src/main.rs index cca704df5..87e3bf725 100644 --- a/crates/meilisearch/src/main.rs +++ b/crates/meilisearch/src/main.rs @@ -155,16 +155,21 @@ async fn prompt_for_contact_email() -> anyhow::Result> { return Ok(None); } - println!("Would you mind providing your contact email for support and news?"); - println!("We will use it to contact you with news only."); + println!("Would you mind providing your contact email for support and news? We will use it to contact you with news only."); + println!("Press enter to skip."); print!("contact email> "); std::io::stdout().flush()?; let mut email = String::new(); let mut stdin = BufReader::new(stdin); let _ = stdin.read_line(&mut email).await?; + let email = email.trim(); - Ok(Some(email.trim().to_string())) + if email.is_empty() { + Ok(None) + } else { + Ok(Some(email.to_string())) + } } async fn run_http(