"Content-disposition: attachment" on .jpg and .JPG means images cannot be displayed in the browser

  • Profile Image
    reidpr
    Asked on May 26, 2012 at 05:09 PM

    Hi,

    Sometime in the past few weeks/months, .jpg and .JPG files acquired a "Content-disposition: attachment" header, so they can no longer be displayed in the browser (instead, a download is forced).

    Looking at some other threads, it seems this hack is required for certain Microsoft file types, but it's inappropriate for most everything else. Thanks!

    Reid

     

    e.g.:

    curl --head --location http://submit.jotform.us/uploads/reidpr/20697284656163/203874711991753973/IMG_0288.jpg
    HTTP/1.1 302 Moved Temporarily
    Server: nginx/1.0.8
    Date: Sat, 26 May 2012 21:06:41 GMT
    Content-Type: text/html
    Content-Length: 160
    Connection: keep-alive
    Location: http://s3.amazonaws.com/jufs/reidpr/20697284656163/203874711991753973/IMG_0288.jpg

    HTTP/1.1 200 OK
    x-amz-id-2: 37lcfSmZIENCOzptRw+WY6I2xrmsNEvg856CwYlpx5lANXghXaVG8hmrdDm6Wdc3
    x-amz-request-id: 2C30ED8B7B672B3C
    Date: Sat, 26 May 2012 21:06:57 GMT
    Content-Disposition: attachment; filename="IMG_0288.jpg"
    Last-Modified: Sat, 26 May 2012 20:52:06 GMT
    ETag: "ca1a3c22f307cd35fa5f4ccafe49fa18"
    Accept-Ranges: bytes
    Content-Type: image/jpeg
    Content-Length: 330357
    Server: AmazonS3

  • Profile Image
    liyam
    Answered on May 26, 2012 at 11:09 PM

    Hello,

    Is this still happening after eee's fix?

    Can you also tell us where this part happens?

    Thanks.

  • Profile Image
    reidpr
    Answered on May 27, 2012 at 12:08 PM

    I don't know when or what eee's fix was, but it still happens as of 30 seconds ago. :)

    It happens anytime you request a .jpg or .JPG file (example above). The easiest way to reproduce it is to use the curl command above, because then you can see the exact headers. But you can also reproduce it with a browser: visit the URL of a .jpg or .JPG file uploaded to a form. it should display in the browser, but instead the browser offers to download it.

    Thanks,

    Reid

  • Profile Image
    liyam
    Answered on May 27, 2012 at 01:15 PM

    Let me forward this matter to the development team.  One of them will respond to this as soon as possible.

    Thanks for your patience.