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
vfs-used-is-size
Nick Craig-Wood 2020-04-22 18:01:59 +01:00
parent 86eaf43b00
commit f8039deb7c
1 changed files with 2 additions and 2 deletions

View File

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