1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-07 11:36:25 +02:00

Check source content length before getting download buffer

This commit is contained in:
DarthSim 2019-05-08 21:00:54 +06:00
parent a03d74288f
commit c6145a8e69

View File

@ -125,6 +125,10 @@ func readAndCheckImage(ctx context.Context, res *http.Response) (context.Context
if res.ContentLength > 0 {
contentLength = int(res.ContentLength)
if conf.MaxSrcFileSize > 0 && contentLength > conf.MaxSrcFileSize {
return ctx, func() {}, errSourceFileTooBig
}
}
buf := downloadBufPool.Get(contentLength)