Skip to content

Commit

Permalink
fix LocationConstraint bug in put_bucket() (closes #171)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeper committed Apr 5, 2018
1 parent 25b3f51 commit 663fc9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* `s3sync()` gains a `direction` argument allowing for unidirectional (upload-only or download-only) synchronization. The default remains bi-directional.
* New functions `put_encryption()`, `get_encryption()`, and `delete_encryption()` implement bucket-level encryption so that encryption does not need to be specified for each `put_object()` call. (#183, h/t Dan Tenenbaum)
* Fixed typos in `s3sync()`. (#211, h/t Nirmal Patel)
* `put_bucket()` only includes a LocationConstraint body when the region != "us-east-1". (#171, h/t David Griswold)

# aws.s3 0.3.10

Expand Down
8 changes: 6 additions & 2 deletions R/put_bucket.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function(bucket,
"bucket-owner-read", "bucket-owner-full-control"),
headers = list(),
...){
b <- paste0('<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LocationConstraint>',
region, '</LocationConstraint></CreateBucketConfiguration>')
if (region == "us-east-1") {
b <- NULL
} else {
b <- paste0('<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LocationConstraint>',
region, '</LocationConstraint></CreateBucketConfiguration>')
}
acl <- match.arg(acl)
headers <- c(list(`x-amz-acl` = acl), headers)
ir <- s3HTTP(verb = "PUT",
Expand Down

0 comments on commit 663fc9d

Please sign in to comment.