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
@@ -171,6 +171,11 @@ func fetchURL(ctx context.Context, url string) (string, error) {
return "", 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 "", types.NewHTTPFetchError(url, types.ErrRemoteFileTooLarge)
}
data, err := io.ReadAll(io.LimitReader(resp.Body, types.RemoteFetchLimit+1))
if err != nil {
return "", types.NewHTTPFetchError(url, err)