fix: validate self-host route URLs consistently

This commit is contained in:
Valerio 2026-05-04 14:30:06 +02:00
parent eede2f6953
commit 1c9def2fde
8 changed files with 26 additions and 10 deletions

View file

@ -74,7 +74,16 @@ impl From<webclaw_fetch::FetchError> for ApiError {
webclaw_fetch::FetchError::InvalidUrl(msg) => {
Self::BadRequest(format!("invalid url: {msg}"))
}
other => Self::Fetch(other.to_string()),
other => {
let msg = other.to_string();
if msg.contains("invalid url:")
|| msg.contains("blocked private or internal address")
{
Self::BadRequest(msg)
} else {
Self::Fetch(msg)
}
}
}
}
}