lib/paperclip/storage.rb in thoughtbot-paperclip-2.2.2 vs lib/paperclip/storage.rb in thoughtbot-paperclip-2.2.3
- old
+ new
@@ -59,12 +59,15 @@
begin
while(true)
path = File.dirname(path)
FileUtils.rmdir(path)
end
- rescue Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL
+ rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR
# Stop trying to remove parent directories
+ rescue SystemCallError => e
+ logger.info("[paperclip] There was an unexpected error while deleting directories: #{e.class}")
+ # Ignore it
end
end
@queued_for_delete = []
end
end
@@ -116,14 +119,14 @@
module S3
def self.extended base
require 'right_aws'
base.instance_eval do
@s3_credentials = parse_credentials(@options[:s3_credentials])
- @bucket = @options[:bucket] || @s3_credentials[:bucket]
- @s3_options = @options[:s3_options] || {}
+ @bucket = @options[:bucket] || @s3_credentials[:bucket]
+ @s3_options = @options[:s3_options] || {}
@s3_permissions = @options[:s3_permissions] || 'public-read'
- @s3_protocol = @options[:s3_protocol] || (@s3_permissions == 'public-read' ? 'http' : 'https')
- @s3_headers = @options[:s3_headers] || {}
+ @s3_protocol = @options[:s3_protocol] || (@s3_permissions == 'public-read' ? 'http' : 'https')
+ @s3_headers = @options[:s3_headers] || {}
@url = ":s3_path_url" unless @url.to_s.match(/^:s3.*url$/)
end
base.class.interpolations[:s3_path_url] = lambda do |attachment, style|
"#{attachment.s3_protocol}://s3.amazonaws.com/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/}, "")}"
end