Update network URL validation error message format to match expected pattern

This commit is contained in:
CodeMan62 2025-04-02 00:19:50 +05:30
parent 5607802fe1
commit fce0fa9c57

View File

@ -211,7 +211,15 @@ async fn patch_network(
let merged = DbRemote { let merged = DbRemote {
url: match new_url { url: match new_url {
Setting::Set(new_url) => new_url, Setting::Set(new_url) => {
if !new_url.starts_with("http://") && !new_url.starts_with("https://") {
return Err(ResponseError::from_msg(
format!("in .remotes.{key}.url: error from Url::parse"),
meilisearch_types::error::Code::InvalidNetworkUrl,
));
}
new_url
},
Setting::Reset => { Setting::Reset => {
return Err(ResponseError::from_msg( return Err(ResponseError::from_msg(
format!( format!(