carrierwaveuploader / carrierwave-aws

AWS-SDK storage adapter for CarrierWave
MIT License
409 stars 107 forks source link

xlsx content-type is wrong #164

Closed farrokhpey closed 4 years ago

farrokhpey commented 4 years ago

I'm using carrierwave-aws and mimemagic latest version, now when upload a xlsx file in s3 everything is OK and file will be uploaded to s3, but when i try to download it, a zip file startdownloading, as i know the content type of file may be wrong, now could you please tell me how can i set correct mime type for xlsx file while uploading using CarrierWave::Uploader::Base config

sorentwo commented 4 years ago

Setting the mime type isn't handled by carrierwave-aws at all. Take a look at the official wiki for a list of plugins that may help you out https://github.com/carrierwaveuploader/carrierwave/wiki

farrokhpey commented 4 years ago

But I need more help, I saw your link but I don't know how should I use them, I'm new to Ruby I need to use carrierwacw-aws and I'm uploading xlsx files, but it seems their mimetype are wrong. now I decide to set miimetyoe manually but I need your help because I don't know how.

sorentwo commented 4 years ago

Setting the content type is handled by carrierwave itself, not carrierwave-aws. The content_type is set from the file that you upload. I believe you can override it directly in your uploader or on the file, but I'm not 100% sure. You'll need to ask on the carrierwave project (which I don't maintain).

In fact, there is an issue there about this exact problem: https://github.com/carrierwaveuploader/carrierwave/issues/1995