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

Commit

Permalink
S3 Regions in the cucubmer specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Aug 20, 2015
1 parent 0e8c21b commit b8221c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions features/basic_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ Feature: Rails integration
And I attach the file "spec/support/fixtures/5k.png" to "Attachment" on S3
And I press "Submit"
Then I should see "Name: something"
And I should see an image with a path of "http://s3.amazonaws.com/paperclip/attachments/original/5k.png"

This comment has been minimized.

Copy link
@betesh

betesh Aug 21, 2015

Contributor

This is failing for Aws v1 because of

"https://paperclip.s3.amazonaws.com#{definition[:path]}"

But what it really shows is that we need an additional test here, for AWS v1 only, where we don't configure an s3_region

And the file at "http://s3.amazonaws.com/paperclip/attachments/original/5k.png" should be uploaded to S3
And I should see an image with a path of "http://s3-us-west-2.amazonaws.com/paperclip/attachments/original/5k.png"
And the file at "http://s3-us-west-2.amazonaws.com/paperclip/attachments/original/5k.png" should be uploaded to S3
5 changes: 3 additions & 2 deletions lib/paperclip/storage/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ def s3_host_name
host_name = @options[:s3_host_name]
host_name = host_name.call(self) if host_name.is_a?(Proc)

host_name || s3_credentials[:s3_host_name] || "s3.amazonaws.com"
region = ["s3", s3_region].compact.join("-")
host_name || s3_credentials[:s3_host_name] || "#{region}.amazonaws.com"
end

def s3_region
region = @options[:s3_region]
region = @options[:s3_region] || s3_credentials[:s3_region]
region = region.call(self) if region.is_a?(Proc)

region || s3_credentials[:s3_region]

This comment has been minimized.

Copy link
@betesh

betesh Aug 21, 2015

Contributor

If s3_credentials[:s3_region] is a Proc, we'll end up returning the Proc. We can probably just remove this line.

Expand Down

0 comments on commit b8221c6

Please sign in to comment.