Bug with Fastimage mime type detection for SVG images

With the determine_mime_type plugin, if using the :fastimage analyzer, svgs are returned with an invalid mime type of image/svg when it should be image/svg+xml

I believe the problem is on this line
shrine/determine_mime_type.rb at 6e93cb29a87fa9a2e771a8692868281f74187b12 · shrinerb/shrine · GitHub where it is assumed that fastimage will return a string that is a valid mime type, but fastimage just returns a symbol :svg

Hi, thanks for the report. Yeah, I agree it makes sense for Shrine to return image/svg+xml in this case. Would you like to send a PR?

I’m sorry to be dumb, but I’ve never contributed to Shrine before and I’m not quite sure how. I’ve got a fix and a test but I don’t seem to have access to submit a PR. I’ve read the contributing doc, but I must be missing a step.

You’re not dumb! What you need to do is fork the Shrine project into your own GitHub account, and then make a branch there, apply your changes and add your tests, and then from there you can make a pull request, which will automagically go back to the original project.

Walter

2 Likes