fix: harden fetch URL validation

This commit is contained in:
Valerio 2026-05-04 11:50:57 +02:00
parent 23544f8fac
commit bdf81fe6bf
10 changed files with 284 additions and 27 deletions

View file

@ -70,7 +70,12 @@ impl IntoResponse for ApiError {
impl From<webclaw_fetch::FetchError> for ApiError {
fn from(e: webclaw_fetch::FetchError) -> Self {
Self::Fetch(e.to_string())
match e {
webclaw_fetch::FetchError::InvalidUrl(msg) => {
Self::BadRequest(format!("invalid url: {msg}"))
}
other => Self::Fetch(other.to_string()),
}
}
}