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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
0 deletions
-
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 { |
|
|
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) |
|
|
return fmt.Errorf("failed to auto-create bucket %s: %w", bucket, err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|