Skip to content

Commit

Permalink
fix #9 - (?) default empty locations to empty string
Browse files Browse the repository at this point in the history
You can't pass "us-east-1" as a location constraint to S3. It responds
with "The specified location-constraint is not valid". I think you can
pass any other location though. This is dumb, but that's how S3 defines
it.

w/r/t 454bb7a
  • Loading branch information
leejo committed Apr 20, 2018
1 parent 454bb7a commit 98b98cf
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions Changes
@@ -1,6 +1,9 @@

Changelog for perl module AWS::S3

0.15 2018-04-20
- Fix (again?) sending of undefined location param in ->add_bucket (GH #9)

0.14 2018-04-13
- Fix sending of undefined location param in ->add_bucket (GH #9)

Expand Down
5 changes: 3 additions & 2 deletions README.markdown
Expand Up @@ -168,9 +168,10 @@ Returns the [AWS::S3::Bucket](https://metacpan.org/pod/AWS::S3::Bucket) object m

Returns nothing otherwise.

## add\_bucket( name => $name )
## add\_bucket( name => $name, location => 'us-west-1' )

Attempts to create a new bucket with the name provided.
Attempts to create a new bucket with the name provided. The location parameter is optional
and, as per the AWS docs, will default to "us-east-1".

On success, returns the new [AWS::S3::Bucket](https://metacpan.org/pod/AWS::S3::Bucket)

Expand Down
Binary file added lib/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/AWS/S3.pm
Expand Up @@ -13,7 +13,7 @@ use AWS::S3::ResponseParser;
use AWS::S3::Owner;
use AWS::S3::Bucket;

our $VERSION = '0.14';
our $VERSION = '0.15';

has [qw/access_key_id secret_access_key/] => ( is => 'ro', isa => 'Str' );

Expand Down
4 changes: 2 additions & 2 deletions lib/AWS/S3/Request/CreateBucket.pm
Expand Up @@ -20,7 +20,7 @@ has 'location' => (

# https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html
# "By default, the bucket is created in the US East (N. Virginia) region."
default => sub { 'us-east-1' },
default => sub { '' },
);

has '+_expect_nothing' => ( default => 1 );
Expand All @@ -30,7 +30,7 @@ sub request {

my $xml = <<"XML";
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>@{[ $s->location || 'us-east-1' ]}</LocationConstraint>
<LocationConstraint>@{[ $s->location || '' ]}</LocationConstraint>
</CreateBucketConfiguration>
XML

Expand Down
Binary file added t/.DS_Store
Binary file not shown.

0 comments on commit 98b98cf

Please sign in to comment.