No commit activity in last 3 years
No release in over 3 years
Extend ActionDispatch::HTTP::UploadedFile to detect file type from magic byte
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

>= 0.3.0
>= 4.1.0
 Project Readme

MimemagicActionPackUploadedFile

Detected content_type by ActionDispatch::HTTP::UploadedFile is not trusted because it does not validate received content_type. Therefore, content_type should be detected by magicbyte. MimemagicActionPackUploadedFile extends ActionDispatch::HTTP::UploadedFile to detects actual content_type with mimemagic

Installation

gem 'mimemagic_action_pack_uploaded_file'

CarrierWave configuration

Define content_type_whitelist to your uploader. [Click here for details](Please https://github.com/carrierwaveuploader/carrierwave#securing-uploads)

class YourUploader < CarrierWave::Uploader::Base
  def content_type_whitelist
    %w(image/jpeg image/png)
  end
end

Testing

bundle exec rake spec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/alpaca-tc/mimemagic_action_pack_uploaded_file.