The website's function is to post a Blog Post. It's running locally on Windows 7. I've tried on Paperclip gem (both versions 4.2.4 and 4.3) and the server goes into an infinite loop in cmd (doesn't happen on 4.2.4 but still get the error). I did bundle install and it's definitely installed.
Gemfile:
gem "paperclip", "~> 4.3"
Here's the model:
class Post < ActiveRecord::Base
has_attached_file :image, :default_url => ":style/rails1.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end
This is the error I get when trying to submit an image (png or jpg):
Image has contents that are not what they are reported to be
I'm new to this so detailed explanations would be appreciated. I read some other fixes on here but nothing worked.
The correct way disable spoof checking is to use: validate_media_type: false
in your attachment definition i.e.
has_attached_file :image, :default_url => ":style/rails1.jpg", validate_media_type: false
Figured out a temporary solution:
Add this file
config/initializers/paperclip_media_type_spoof_detector_override.rb
require 'paperclip/media_type_spoof_detector'
module Paperclip
class MediaTypeSpoofDetector
def spoofed?
false
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With