imgflo-server icon indicating copy to clipboard operation
imgflo-server copied to clipboard

Input images with wrong content-type/extension give 500

Open jonnor opened this issue 9 years ago • 3 comments

Example request https://imgflo.herokuapp.com/graph/851b8fd15e770b1/bdc2476fe451696ebc84c2a17fbfb78d/passthrough.jpg?input=https%3A%2F%2Fimgflo.herokuapp.com%2Fgraph%2F2b2431f8e7ba7b0%2F8a82878dd7f43d6e39d117119257b395%2Fnoop.jpg%3Finput%3Dhttp%253A%252F%252Fassets.atlasobscura.com%252Farticle_images%252F36870%252Fimage.jpg&width=720

The input image is served as jpg, but is actually a PNG file http://assets.atlasobscura.com/article_images/36870/image.jpg

      -  "Not a JPEG file: starts with 0x89 0x50"

file image.jpg
image.jpg: PNG image data, 800 x 1066, 8-bit/color RGBA, non-interlaced

jonnor avatar Nov 15 '16 22:11 jonnor

Web browsers generally handle this case fine, so we should too.

This happens because we trust, and specify a particular GEGL file loader based on that. It looks like gegl:load support some file sniffing now though, in which case should be easy-fix.

Related #31 #23

jonnor avatar Nov 15 '16 22:11 jonnor

Another example failing is https://imgflo.herokuapp.com/graph/851b8fd15e770b1/3d6034f3cf95fcc516d9e269f8222b73/passthrough.png?input=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fthe-grid-img%2Fp%2F4c2aa71f774183b698c1df3f3a0bac4a57df5dd9.png&width=600

The input there is 4c2aa71f774183b698c1df3f3a0bac4a57df5dd9.png: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=0], baseline, precision 8, 600x315, frames 3

jonnor avatar Nov 23 '16 12:11 jonnor

And another example

https://imgflo.herokuapp.com/graph/851b8fd15e770b1/0063518e4cb3262d6686be02614e2745/passthrough.jpg?input=https%3A%2F%2Fthe-grid-user-content.s3-us-west-2.amazonaws.com%2Fd6b17126-5a21-4ea7-a0f2-2b3c506f0416.jpg&width=1440

d6b17126-5a21-4ea7-a0f2-2b3c506f0416.jpg: PNG image data, 1920 x 1440, 8-bit/color RGBA, non-interlaced

jonnor avatar Jan 17 '17 16:01 jonnor