1

I ran into the error that when I upload images to S3 via Paperclip, I get an error: has an extension that does not match its contents. On a local machine, I do not experience such problems, only for production. This was observed after the update of rails 4.1.1 -> 4.1.16 and ruby 2.1.5 -> 2.3.1 and changing the instance to AWS.

Here is my validation:

validates_attachment    :document,
                        content_type: { not: "application/x-msdownload" }

I do not understand what the problem is. Any file I upload, whether it's an image or a document (any extension) gets this error. Tell me please, with what it can be connected?

UPD

I found in log this:

[paperclip] Content Type Spoof: Filename example1.png (["image/png"]), content type discovered from file command: . See documentation to allow this combination.

UPD 2

This solved my problem

  • Not sure what version of `paperclip` you are using but you should check since: `Paperclip now requires Ruby version >= 2.1 and Rails version >= 4.2 (only if you're going to use Paperclip with Ruby on Rails.)` (from https://github.com/thoughtbot/paperclip#requirements) – jdgray Jun 20 '17 at 17:22
  • @jdgray I use version 4.2. This bug related with spoof. –  Jun 22 '17 at 06:59
  • Oh okay your question said `4.1.1 -> 4.1.16` – jdgray Jun 22 '17 at 16:06
  • @jdgray sorry, my rails version `4.1.6` Paperclip version `4.2`. I think that you meant paperclip version. –  Jun 23 '17 at 07:47
  • Your question specifically says: "update of rails 4.1.1 -> 4.1.16".... – jdgray Jun 23 '17 at 16:34

0 Answers0