Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix reduced S3 pour paperclip 2.5

  • Loading branch information...
commit c7a750e50ac69e3dac613b16835f1e3c2a272b97 1 parent 3f683c2
@veilleperso authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/storage/reduceds3.rb
View
13 lib/storage/reduceds3.rb
@@ -259,6 +259,8 @@ def exists?(style = default_style)
else
false
end
+ rescue AWS::Errors::Base
+ false
end
def s3_permissions(style = default_style)
@@ -304,15 +306,14 @@ def flush_writes #:nodoc:
:acl => acl
}
write_options[:metadata] = @s3_metadata unless @s3_metadata.empty?
-
+ write_options.merge!(@s3_headers)
+
# FIX OLIVIER : we personnalize headers for reduced_s3 per thumb
- # write_options.merge!(@s3_headers)
- my_headers = @s3_headers ? @s3_headers.dup : {}
- if @options.styles[style][:s3_reduced]
- my_headers['x-amz-storage-class'] = 'REDUCED_REDUNDANCY'
+ if @options[:styles][style][:s3_reduced]
+ write_options[:storage_class] = :reduced_redundancy
end
- write_options.merge!(my_headers)
# END FIX
+
s3_object(style).write(file, write_options)
rescue AWS::S3::Errors::NoSuchBucket => e
create_bucket
Please sign in to comment.
Something went wrong with that request. Please try again.