我有一个应用程序管理一些文件,如.blend
文件。
.blend
不是标准的mime 类型,所以我将此选项添加到config/environment.rb
:
Paperclip.options[:content_type_mappings][:blend] = "application/octet-stream"
value"application/octet-stream"
是命令返回的值
$ file -b --mime 'x.blend'
application/octet-stream; charset=binary
$ file -v
file-5.11
我遇到的问题是应用程序部署在多台服务器上,并且它们的file
版本不同。例如,在其他服务器中:
$ file -b --mime 'x.blend'
binary; charset=binary
$ file -v
file-5.17
所以回形针检测到一个恶搞
[paperclip] Content Type Spoof: Filename x.blend ([]), content type discovered from file command: binary. See documentation to allow this combination.
我尝试将 content_type_mapping 设置为数组 ( ["application/octet-stream", "binary"]
) 但它不起作用。
你有什么想法吗?是否可以禁用此欺骗检查?