send: stream media downloads with hard size caps

download_to_temp now uses download_media_limited: non-photos abort the
moment the 10 MiB upload cap is crossed mid-stream (no more full-body
buffering before the size check), photos cap at the 512 MiB decode
budget, and the ugoira frame zip gets a 512 MiB cap. MediaTooLarge
routes to the existing smaller-URL fallback.
This commit is contained in:
2026-08-08 20:03:14 +08:00
parent f6df3e28cb
commit d61dba5096
3 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ impl PixivAPI {
let Some(zip_url) = zip_url else {
return Ok(None);
};
let zip_bytes = crate::site::download_media(&zip_url)
let zip_bytes = crate::site::download_media_limited(&zip_url, 512 * 1024 * 1024)
.await
.map_err(|e| match e {
FetchError::Http(e) => PixivError::Http(e),