mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 04:32:29 +02:00
Fix crashes in cases where the max_bytes
processing option was used and image saving failed
This commit is contained in:
@@ -211,7 +211,7 @@ func saveImageToFitBytes(ctx context.Context, po *options.ProcessingOptions, img
|
||||
|
||||
for {
|
||||
imgdata, err := img.Save(po.Format, quality)
|
||||
if len(imgdata.Data) <= po.MaxBytes || quality <= 10 || err != nil {
|
||||
if err != nil || len(imgdata.Data) <= po.MaxBytes || quality <= 10 {
|
||||
return imgdata, err
|
||||
}
|
||||
imgdata.Close()
|
||||
|
Reference in New Issue
Block a user