Skip to content

Commit 6c45de6

Browse files
author
Aaron Schlesinger
committed
fix(pkg/gitreceive/bucket.go): check for BucketAlreadyExists, not 409
the AWS error is “BucketAlreadyExists”, not 409
1 parent 3d5feb3 commit 6c45de6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/gitreceive/storage/bucket.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66
"github.com/aws/aws-sdk-go/service/s3"
77
)
88

9+
const (
10+
bucketAlreadyExistsCode = "BucketAlreadyExists"
11+
)
12+
913
var (
1014
// ACLPublicRead default ACL for objects in the S3 API compatible storage
1115
ACLPublicRead = aws.String("public-read")
@@ -38,7 +42,7 @@ func CreateBucket(svc *s3.S3, bucketName string) error {
3842

3943
if err != nil {
4044
if awsErr, ok := err.(awserr.Error); ok {
41-
if awsErr.Code() == "409" {
45+
if awsErr.Code() == bucketAlreadyExistsCode {
4246
return nil
4347
}
4448
}

0 commit comments

Comments
 (0)