【发布时间】:2016-04-12 05:18:53
【问题描述】:
我有一个模型 Shop,它有一个 logo,它存储在 amazon s3 中,我想将它复制到另一个模型 Company,我这样做很简单:
shop = Shop.find(1)
company = Company.find(1)
company.logo = shop.logo
company.save!
但它给出了一个错误:
[paperclip] copying logos/1/original/220px-Bart_Simpson.png to local file /tmp/dac9e3329951078b23c5deed39f3193120160107-30855-ivrdms.png
No Such Key - cannot copy logos/1/original/220px-Bart_Simpson.png to local file /tmp/dac9e3329951078b23c5deed39f3193120160107-30855-ivrdms.png
Command :: file -b --mime '/tmp/dac9e3329951078b23c5deed39f3193120160107-30855-nz0h5c.png'
[paperclip] Content Type Spoof: Filename 220px-Bart_Simpson.png (["image/png"]), content type discovered from file command: inode/x-empty. See documentation to allow this combination.
ROLLBACK
ActiveRecord::RecordInvalid: Validation failed: Logo has an extension that does not match its contents
有人能说说这里到底发生了什么,或者怎么做吗?
【问题讨论】:
标签: ruby-on-rails amazon-s3 paperclip aws-sdk