mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Respond with 422 on error during image loading
This commit is contained in:
parent
524434b63f
commit
b3905c0cd3
@ -6,6 +6,7 @@
|
||||
|
||||
### Change
|
||||
- Preserve GIF's bit-per-sample.
|
||||
- Respond with 422 on error during image loading.
|
||||
|
||||
## [3.17.0] - 2023-05-10
|
||||
### Add
|
||||
|
10
vips/vips.go
10
vips/vips.go
@ -11,6 +11,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
@ -152,7 +153,14 @@ func Cleanup() {
|
||||
|
||||
func Error() error {
|
||||
defer C.vips_error_clear()
|
||||
return ierrors.NewUnexpected(C.GoString(C.vips_error_buffer()), 1)
|
||||
|
||||
errstr := strings.TrimSpace(C.GoString(C.vips_error_buffer()))
|
||||
|
||||
if strings.Contains(errstr, "load_buffer: ") {
|
||||
return ierrors.New(422, errstr, "Broken or unsupported image")
|
||||
}
|
||||
|
||||
return ierrors.NewUnexpected(errstr, 1)
|
||||
}
|
||||
|
||||
func hasOperation(name string) bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user