Permalink
Browse files

Make sure Paperclip doesn't raise an exception when using a numeric s…

…tyle name
  • Loading branch information...
1 parent f6e01b6 commit 8edccdce415e0d556fc367e120f8b042cbe07bdd @webmat webmat committed Mar 12, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/paperclip/interpolations.rb
  2. +1 −1 lib/paperclip/storage/s3.rb
@@ -93,7 +93,7 @@ def basename attachment, style_name
# If the style has a format defined, it will return the format instead
# of the actual extension.
def extension attachment, style_name
- ((style = attachment.styles[style_name.to_sym]) && style[:format]) ||
+ ((style = attachment.styles[style_name.to_s.to_sym]) && style[:format]) ||
File.extname(attachment.original_filename).gsub(/^\.+/, "")
end
@@ -95,7 +95,7 @@ def self.extended base
@s3_permissions = set_permissions(@options[:s3_permissions])
@s3_protocol = @options[:s3_protocol] ||
Proc.new do |style, attachment|
- permission = (@s3_permissions[style.to_sym] || @s3_permissions[:default])
+ permission = (@s3_permissions[style.to_s.to_sym] || @s3_permissions[:default])
permission = permission.call(attachment, style) if permission.is_a?(Proc)
(permission == :public_read) ? 'http' : 'https'
end

0 comments on commit 8edccdc

Please sign in to comment.