mirror of
https://github.com/0xMassi/webclaw.git
synced 2026-06-19 01:58:06 +02:00
fix: validate self-host route URLs consistently
This commit is contained in:
parent
eede2f6953
commit
1c9def2fde
8 changed files with 26 additions and 10 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue