Browse Source

Update weed/s3api/s3api_bucket_handlers.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
pull/7549/head
Chris Lu 1 week ago
committed by GitHub
parent
commit
ab1bb15e73
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      weed/s3api/s3api_bucket_handlers.go

5
weed/s3api/s3api_bucket_handlers.go

@ -587,6 +587,11 @@ func (s3a *S3ApiServer) autoCreateBucket(r *http.Request, bucket string) error {
}
if err := s3a.mkdir(s3a.option.BucketsPath, bucket, fn); err != nil {
// In case of a race condition where another request created the bucket
// in the meantime, check for existence before returning an error.
if exist, _ := s3a.exists(s3a.option.BucketsPath, bucket, true); exist {
return nil
}
return fmt.Errorf("failed to auto-create bucket %s: %w", bucket, err)
}

Loading…
Cancel
Save