Say which input the image processor refuses before decoding
check / check (push) Waiting to run

README.md, the doc comment of ErrUnsupportedInputFormat and the TODO.md
entry say the 415 is for input whose first bytes libvips reads as
another format, and no longer read as refusing a damaged image in a
source format, which is decoded and answers 500. The doc comment of
TestImageProcessor_OrigOfUnnamedFormatRefused says TIFF is refused
before it is decoded.

Model: opus-5-5
This commit is contained in:
2026-10-13 04:24:18 +00:00
parent 6241c6a425
commit c80e0e48b1
4 changed files with 26 additions and 20 deletions
+7 -4
View File
@@ -138,7 +138,9 @@ var ErrInputDataTooLarge = errors.New("input data exceeds maximum allowed size")
var ErrUnsupportedOutputFormat = errors.New("unsupported output format")
// ErrUnsupportedInputFormat is returned, before the input is decoded, when
// libvips would not load it as one of the source formats.
// libvips reads the input's first bytes as another format than the source
// formats, or as none: for example an SVG whose first bytes pass the
// first-bytes check for AVIF.
var ErrUnsupportedInputFormat = errors.New("unsupported input format")
// ErrTooManyImages is returned when MaxConcurrentProcessing images are being
@@ -223,9 +225,10 @@ func (p *ImageProcessor) Process(
return nil, ErrInputDataTooLarge
}
// govips picks the libvips loader with DetermineImageType. Input it
// would not load as a source format, such as SVG, which librsvg would
// render, is refused before libvips reads it.
// govips picks the libvips loader from the input's first bytes with
// DetermineImageType. Input whose first bytes it reads as no source
// format, such as SVG, which librsvg would render, is refused before
// libvips reads it.
inputFormat := p.detectFormat(vips.DetermineImageType(data))
sourceFormat, err := p.formatFromString(inputFormat)