Skip to content
This repository was archived by the owner on Mar 3, 2021. It is now read-only.
This repository was archived by the owner on Mar 3, 2021. It is now read-only.

paperclip reports spoofed image file type for some images #6

@Qwertie-

Description

@Qwertie-

While uploading images I found that some of them were failing to upload with the error
Content Type Spoof: Filename local.path (image/jpeg from Headers, [] from Extension), content type discovered from file command: image/jpeg. See documentation to allow this combination.

I found that adding the file name while uploading fixed this issue

file_name = File.basename(image_path)
attachment = Faraday::UploadIO.new(image, file_type, file_name)

Not sure if you want to add this in to the example code, shouldn't ever hurt to send the file name but this should at least help someone with the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions