JPG images get mime_type application/octet-stream

906 views
Skip to first unread message

Anita Graham

unread,
Mar 12, 2017, 9:02:56 AM3/12/17
to Dragonfly
Hi,

I'm using a very simple Refinery CMS application.  Some of the images return a mime_type of application/octet-stream. These images have filenames which include an extension:

guid: 2016/03/03/31rcxe434_IMG_0844.JPG image_name: IMG_0844.JPG
guid: 2016/03/03/6hkn0yuiyx_GITW1.jpg   image_name: GITW1.jpg


A Refinery::Image has an image_mime_type field, which is null for all images in this db, including images which return a correct mime_types.
It looks as the images table had an image_ext field originally, but that was removed about 5 years ago.

The images with a 'bad' mime-type work on web pages.  It is only when editing text fields (such as title) that the image update files with an incorrect mime type.

I suppose I could just add application/octet-stream to the list of accepted mime-types.

Mark, hope all is going well with you  - you have always been very helpful here.

Anita Graham

Mark Evans

unread,
Mar 23, 2017, 7:57:38 AM3/23/17
to dragonf...@googlegroups.com
Hi

I'm using a very simple Refinery CMS application.  Some of the images return a mime_type of application/octet-stream. These images have filenames which include an extension:

guid: 2016/03/03/31rcxe434_IMG_0844.JPG image_name: IMG_0844.JPG
guid: 2016/03/03/6hkn0yuiyx_GITW1.jpg   image_name: GITW1.jpg


When you say “return” application/octet-stream - you mean when served by the Dragonfly server?
does the “name” field in the stored meta for these images have the image name (including jpg)?


A Refinery::Image has an image_mime_type field, which is null for all images in this db, including images which return a correct mime_types.
I’m not surprised because only “image_name”, “image_size” and any analyers “image_…” is a magic attribute http://markevans.github.io/dragonfly/models#magic-attributes 
and mime_type is not an analyser method (like width, etc.)

It looks as the images table had an image_ext field originally, but that was removed about 5 years ago.
it was removed because having an image_name column is sufficient

It’s difficult to say without knowing how the app works (and how Refinery is using Dragonfly) but I don’t think this is related to https://github.com/markevans/dragonfly/pull/438 , unless the images were originally pulled down from a remote url or something.

If you look in the stored meta for these images (<uid>.meta.yml files) then they should have a “name” field as “IMG_0844.JPG”, etc.
If not that might be what’s causing the problem
Reply all
Reply to author
Forward
0 new messages