0

我有一个应用程序管理一些文件,如.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"]) 但它不起作用。

你有什么想法吗?是否可以禁用此欺骗检查?

4

1 回答 1

0

对于那些有同样问题的人,我的允许多个映射的解决方案刚刚被 Paperclip 接受。你只需要得到它的最后一个版本。

https://github.com/thoughtbot/paperclip/commit/ea142d80eb2f87c5ce7597026a58cd873d9de3a3

于 2015-04-30T12:38:35.850 回答