Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


S3 Mime-type improvement #15

merged 1 commit into from

2 participants


by default S3 transfer method sets mime-type of original file but in the case of videos we need to set different mime-types based on process file format. So now S3 transfer method has optional parameter for setting custom Mime-type

@yuritomanek yuritomanek merged commit 6377e86 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2013
  1. mime_type optional param for s3 transfer (by default it take from ass…

    Abdul Rauf authored
    …ets object)
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/gluttonberg/library/storage/s3.rb
8 lib/gluttonberg/library/storage/s3.rb
@@ -44,7 +44,7 @@ def self.bucket_handle
#takes file from public/assets folder and upload to s3 if s3 info is given in CMS settings
- def self.migrate_file_to_s3(asset_hash , file_name)
+ def self.migrate_file_to_s3(asset_hash , file_name, mime_type='')
bucket = bucket_handle
unless bucket.blank?
local_file = "public/user_assets/" + asset_hash + "/" + file_name
@@ -55,8 +55,10 @@ def self.migrate_file_to_s3(asset_hash , file_name)
unless asset.blank?
puts " Copying #{local_file} to #{S3::ClassMethods.s3_bucket_name}"
- unless asset.mime_type.blank?
- key.write(, {:expires => date.rfc2822, :content_type => asset.mime_type , :acl => :public_read })
+ mime_type = asset.mime_type if mime_type.blank?
+ unless mime_type.blank?
+ key.write(, {:expires => date.rfc2822, :content_type => mime_type , :acl => :public_read })
key.write( , {:expires => date.rfc2822 , :acl => :public_read })
Something went wrong with that request. Please try again.