Given the volume and variety of images Thumbor deals with it's inevitable that it will encounter corrupt or otherwise invalid images. Currently when we attempt to transform an image that is not valid for its filetype we will make a best effort and then fail with a 500 error. This is neither specific enough to be useful to users nor for operators of the service as it is indistinguishable from genuine service failures unless specifically investigated. We saw an example of this in T327941.
We should make an attempt to validate that a file is valid for its format before attempting to resize or convert it, and either
- refuse to operate on it outright, or
- note that the file is potentially invalid and, upon failure to transform it, return this as the reason for failure rather than a generic service failure.
In any case it should be clear both to the user and the service operator that the image conversion failed because of the source image. This will help identify other, real internal service failures.
Obviously dealing with a large number of formats makes this a broad problem - Tool candidates for this are (amongst others):
- jpeginfo -c
- pngcheck
- libtiff-tools