refactor(script): drop the per-call maxBodySize and its client cache

This commit is contained in:
aykhans committed 2026-09-29 10:58:25 +04:00
1 parent ef5907dc0c
commit 9c7b7c26a0
10 files changed
+54 -146

No files matched your search

+5
View File
@@ -79,6 +79,11 @@ func fetchHTTP(ctx context.Context, url string) ([]byte, error) {
return nil, types.NewHTTPStatusError(url, resp.StatusCode, resp.Status)
}
// A declared size above the limit is refused before anything is read.
if resp.ContentLength > types.RemoteFetchLimit {
return nil, types.NewHTTPFetchError(url, types.ErrRemoteFileTooLarge)
}
data, err := io.ReadAll(io.LimitReader(resp.Body, types.RemoteFetchLimit+1))
if err != nil {
return nil, types.NewHTTPFetchError(url, err)