From 2bc503771bf18d1c8fddd2e94e8b7742f8e80d13 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 8 Aug 2024 17:07:42 -0400 Subject: [PATCH] assistant: Show an error when `/fetch` returns no content (#16001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR makes it so the `/fetch` slash command will display an error when the URL does not have any textual content: Screenshot 2024-08-08 at 4 51 55 PM Release Notes: - N/A --- crates/assistant/src/slash_command/fetch_command.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/assistant/src/slash_command/fetch_command.rs b/crates/assistant/src/slash_command/fetch_command.rs index e1a784f71a..e3b1b92aba 100644 --- a/crates/assistant/src/slash_command/fetch_command.rs +++ b/crates/assistant/src/slash_command/fetch_command.rs @@ -150,6 +150,10 @@ impl SlashCommand for FetchSlashCommand { let url = SharedString::from(url); cx.foreground_executor().spawn(async move { let text = text.await?; + if text.trim().is_empty() { + bail!("no textual content found"); + } + let range = 0..text.len(); Ok(SlashCommandOutput { text,