fix: incorrect max_size in /api/address

feat/type-attributes
Tomáš Mládek 2023-05-20 18:16:50 +02:00
parent e2dcb05776
commit db26a4ed32
1 changed files with 4 additions and 2 deletions

View File

@ -658,7 +658,7 @@ pub async fn get_address(
} else if let Some(url) = query.get("url_content") {
let url = Url::parse(url).map_err(ErrorBadRequest)?;
const MAX_SIZE: usize = 128_000;
const MAX_SIZE: usize = 128_000_000;
let client = reqwest::blocking::Client::builder()
.user_agent(APP_USER_AGENT.as_str())
@ -679,7 +679,9 @@ pub async fn get_address(
.and_then(|cl| cl.parse::<usize>().ok())
{
if content_length > MAX_SIZE {
return Err(ErrorBadRequest("Error: The response is too large."));
return Err(ErrorBadRequest(format!(
"Error: The response is too large ({content_length} > {MAX_SIZE})."
)));
}
}
} else {