s3: fix detection of BucketAlreadyOwnedByYou and BucketAlreadyExists error

This was being silently ignored until this commit

e2bf91452a s3: report errors on bucket creation (mkdir) correctly
This commit is contained in:
Nick Craig-Wood 2020-04-22 18:01:59 +01:00
parent 86eaf43b00
commit f8039deb7c

View file

@ -1733,8 +1733,8 @@ func (f *Fs) makeBucket(ctx context.Context, bucket string) error {
if err == nil { if err == nil {
fs.Infof(f, "Bucket %q created with ACL %q", bucket, f.opt.BucketACL) fs.Infof(f, "Bucket %q created with ACL %q", bucket, f.opt.BucketACL)
} }
if err, ok := err.(awserr.Error); ok { if awsErr, ok := err.(awserr.Error); ok {
if err.Code() == "BucketAlreadyOwnedByYou" { if code := awsErr.Code(); code == "BucketAlreadyOwnedByYou" || code == "BucketAlreadyExists" {
err = nil err = nil
} }
} }