I have a model Shop
which has a logo
and it's stored in amazon s3, i want to copy it to another model Company
, i'm doing simply:
shop = Shop.find(1)
company = Company.find(1)
company.logo = shop.logo
company.save!
but its giving an error:
[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
Can somebody say what the hell is going on here, or how to do it?
Can you try as, May I know which version of paperclip is being used.
shop = Shop.find(1)
company = Company.find(1)
company.logo = File.open(shop.logo.path, 'rb')
company.save!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.