Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant_slash_commands: Be more precise in content type matching (#29124)

Eva Pace55fd8352e4d7
diff --git a/crates/assistant_slash_commands/src/fetch_command.rs b/crates/assistant_slash_commands/src/fetch_command.rs
index 6c1badeb741..2b98a21b6f3 100644
--- a/crates/assistant_slash_commands/src/fetch_command.rs
+++ b/crates/assistant_slash_commands/src/fetch_command.rs
@@ -55,11 +55,14 @@ impl FetchSlashCommand {
let content_type = content_type
.to_str()
.context("invalid Content-Type header")?;
- let content_type = match content_type {
- "text/html" => ContentType::Html,
- "text/plain" => ContentType::Plaintext,
- "application/json" => ContentType::Json,
- _ => ContentType::Html,
+ let content_type = if content_type.starts_with("text/html") {
+ ContentType::Html
+ } else if content_type.starts_with("text/plain") {
+ ContentType::Plaintext
+ } else if content_type.starts_with("application/json") {
+ ContentType::Json
+ } else {
+ ContentType::Html
};
match content_type {