lib/httpimagestore/configuration/s3.rb in httpimagestore-1.7.0 vs lib/httpimagestore/configuration/s3.rb in httpimagestore-1.8.0

- old
+ new

@@ -175,15 +175,15 @@ def write(data, options = {}) s3_object.write(data, options) end def private_url - s3_object.url_for(:read, expires: 60 * 60 * 24 * 365 * 20).to_s # expire in 20 years + s3_object.url_for(:read, expires: 60 * 60 * 24 * 365 * 20) # expire in 20 years end def public_url - s3_object.public_url.to_s + s3_object.public_url end def content_type s3_object.head[:content_type] end @@ -235,14 +235,22 @@ @cache_file.header['content_type'] = options[:content_type] if options[:content_type] dirty! :write end def private_url - @cache_file.header['private_url'] ||= (dirty! :private_url; super) + url = @cache_file.header['private_url'] and return URI(url) + dirty! :private_url + url = super + @cache_file.header['private_url'] = url.to_s + url end def public_url - @cache_file.header['public_url'] ||= (dirty! :public_url; super) + url = @cache_file.header['public_url'] and return URI(url) + dirty! :public_url + url = super + @cache_file.header['public_url'] = url.to_s + url end def content_type @cache_file.header['content_type'] ||= (dirty! :content_type; super) end