I have an application managing some files like .blend
files.
.blend
is not a standard mime type, so I add this options into config/environment.rb
:
Paperclip.options[:content_type_mappings][:blend] = "application/octet-stream"
The value "application/octet-stream"
is the value returned by the command
$ file -b --mime 'x.blend'
application/octet-stream; charset=binary
$ file -v
file-5.11
The issue I have is that the application is deployed on several servers, and they have not the same file
version. For example, in an other server:
$ file -b --mime 'x.blend'
binary; charset=binary
$ file -v
file-5.17
So Paperclip detects a spoof
[paperclip] Content Type Spoof: Filename x.blend ([]), content type discovered from file command: binary. See documentation to allow this combination.
I tried to set content_type_mapping as an array (["application/octet-stream", "binary"]
) but it doesn't work.
Have you any idea? Is it possible to disable this spoof check?
For thoses having same issue, my solution to allows multiple mappings was just accepted by Paperclip. You just have to get the last version of it.
https://github.com/thoughtbot/paperclip/commit/ea142d80eb2f87c5ce7597026a58cd873d9de3a3