Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Make sure Paperclip doesn't raise an exception when using a numeric s…
Browse files Browse the repository at this point in the history
…tyle name
  • Loading branch information
webmat committed Mar 12, 2012
1 parent f6e01b6 commit 8edccdc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/paperclip/interpolations.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/storage/s3.rb
Expand Up @@ -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
Expand Down

0 comments on commit 8edccdc

Please sign in to comment.