mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-26 11:38:01 +02:00
Fix reporting image loading errors
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
- Don't report `The image request is cancelled` errors.
|
||||
- (pro) Change the `/info` endpoint behavior to return only the first EXIF/XMP/IPTC block data of JPEG if the image contains multiple metadata blocks of the same type.
|
||||
|
||||
### Fix
|
||||
- Fix reporting image loading errors.
|
||||
|
||||
### Fix
|
||||
- Fix the `Cache-Control` and `Expires` headers behavior when both `IMGPROXY_CACHE_CONTROL_PASSTHROUGH` and `IMGPROXY_FALLBACK_IMAGE_TTL` configs are set.
|
||||
- (pro) Fix the `IMGPROXY_FALLBACK_IMAGE_TTL` config behavior when the `fallback_image_url` processing option is used.
|
||||
|
@@ -24,7 +24,7 @@ func LogResponse(reqID string, r *http.Request, status int, err *ierrors.Error,
|
||||
var level log.Level
|
||||
|
||||
switch {
|
||||
case status >= 500:
|
||||
case status >= 500 || (err != nil && err.Unexpected):
|
||||
level = log.ErrorLevel
|
||||
case status >= 400:
|
||||
level = log.WarnLevel
|
||||
|
@@ -155,12 +155,14 @@ func Error() error {
|
||||
defer C.vips_error_clear()
|
||||
|
||||
errstr := strings.TrimSpace(C.GoString(C.vips_error_buffer()))
|
||||
err := ierrors.NewUnexpected(errstr, 1)
|
||||
|
||||
if strings.Contains(errstr, "load_buffer: ") {
|
||||
return ierrors.New(422, errstr, "Broken or unsupported image")
|
||||
err.StatusCode = 422
|
||||
err.PublicMessage = "Broken or unsupported image"
|
||||
}
|
||||
|
||||
return ierrors.NewUnexpected(errstr, 1)
|
||||
return err
|
||||
}
|
||||
|
||||
func hasOperation(name string) bool {
|
||||
|
Reference in New Issue
Block a user