| ... | @@ -348,7 +348,14 @@ fn download(path: &str, limit: u64) -> Result<Vec<u8>, String> { | ... | @@ -348,7 +348,14 @@ fn download(path: &str, limit: u64) -> Result<Vec<u8>, String> { |
| 348 | agent | 348 | agent |
| 349 | .get(&format!("{BASE}{path}")) | 349 | .get(&format!("{BASE}{path}")) |
| 350 | .call() | 350 | .call() |
| 351 | .and_then(|mut response| response.body_mut().with_config().limit(limit).read_to_vec()) | 351 | .and_then(|mut response| { |
| | 352 | // ureq refuses a body that reaches its limit, so an exact size needs one byte more. |
| | 353 | response |
| | 354 | .body_mut() |
| | 355 | .with_config() |
| | 356 | .limit(limit + 1) |
| | 357 | .read_to_vec() |
| | 358 | }) |
| 352 | .map_err(|error| error.to_string()) | 359 | .map_err(|error| error.to_string()) |
| 353 | } | 360 | } |
| 354 | | 361 | |