Question

I am using CentOS. I have paperclip gem newest version. I have read about spoofing and yet problem still persists! I even tried older version 3.5.2 and still getting error. I am doing this on remote server! Dont know if I have to restart apache or something? Heelp!

I, [2014-04-09T18:41:45.251093 #5841]  INFO -- : Command :: file -b --mime-type '/tmp/5b42e9da0503617fea7f216d7860262920140409-5841-k6wzm6'
I, [2014-04-09T18:41:45.257581 #5841]  INFO -- : [paperclip] Content Type Spoof: Filename justdoit.jpeg (["image/jpeg"]), content type discovered from file command: . See documentation to allow this combination.

After adding Options , Now I am getting this:

I, [2014-04-09T21:20:46.797630 #11118]  INFO -- : Started GET "/system/bboys/avatars/000/000/001/medium/Casper_Family_11.jpg?1397064045" for 90.197.101.127 at 2014-04-09 21:20:46 +0400
F, [2014-04-09T21:20:46.799580 #11118] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/system/bboys/avatars/000/000/001/medium/Casper_Family_11.jpg"):
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
Was it helpful?

Solution

If you aren't worried about the spoofing check for jpeg/jpg files you can set the Paperclip option:

Paperclip.options[:content_type_mappings] = { jpeg: 'image/jpeg', jpg: 'image/jpeg' }

This will bypass the file -b --mime-type command.

OTHER TIPS

My problem was that I didnt have installed ImageMagic and it is a requirement for paperclip to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top