回形针宝石欺骗错误? [英] Paperclip gem spoofing error?

查看:42
本文介绍了回形针宝石欺骗错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 CentOS.我有回形针 gem 最新版本.我已阅读有关欺骗的内容,但问题仍然存在!我什至尝试过旧版本 3.5.2,但仍然出现错误.我在远程服务器上做这个!不知道我是否必须重新启动apache或什么?救命!

I am using CentOS. I have paperclip gem newest version. I have read about spoofing and yet problem still persists! I even tried older version 3.5.2 and still getting error. I am doing this on remote server! Dont know if I have to restart apache or something? Heelp!

I, [2014-04-09T18:41:45.251093 #5841]  INFO -- : Command :: file -b --mime-type '/tmp/5b42e9da0503617fea7f216d7860262920140409-5841-k6wzm6'
I, [2014-04-09T18:41:45.257581 #5841]  INFO -- : [paperclip] Content Type Spoof: Filename justdoit.jpeg (["image/jpeg"]), content type discovered from file command: . See documentation to allow this combination.

添加 Options 后,现在我得到了这个:

After adding Options , Now I am getting this:

I, [2014-04-09T21:20:46.797630 #11118]  INFO -- : Started GET "/system/bboys/avatars/000/000/001/medium/Casper_Family_11.jpg?1397064045" for 90.197.101.127 at 2014-04-09 21:20:46 +0400
F, [2014-04-09T21:20:46.799580 #11118] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/system/bboys/avatars/000/000/001/medium/Casper_Family_11.jpg"):
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'

推荐答案

如果您不担心 jpeg/jpg 文件的欺骗检查,您可以设置 Paperclip 选项:

If you aren't worried about the spoofing check for jpeg/jpg files you can set the Paperclip option:

Paperclip.options[:content_type_mappings] = { jpeg: 'image/jpeg', jpg: 'image/jpeg' }

这将绕过 file -b --mime-type 命令.

这篇关于回形针宝石欺骗错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆