fix(fetch): guard challenge detection before utf8 decoding

This commit is contained in:
Valerio 2026-05-12 11:46:33 +02:00 committed by Valerio
parent a611ae26f3
commit 3bcb288d13

View file

@ -783,6 +783,10 @@ fn is_pdf_content_type(headers: &http::HeaderMap) -> bool {
/// Detect if a response looks like a bot protection challenge page.
fn is_challenge_response(response: &Response) -> bool {
let body_len = response.body().len();
if body_len > 15_000 || body_len == 0 {
return false;
}
is_challenge_html(response.text().as_ref())
}