Skip to content

Return a 409 when attempting to create a bucket that already exists - #805

Merged
fsouza merged 1 commit into
fsouza:mainfrom
dnerdy:existing-bucket-409
Jun 2, 2022
Merged

Return a 409 when attempting to create a bucket that already exists#805
fsouza merged 1 commit into
fsouza:mainfrom
dnerdy:existing-bucket-409

Conversation

@dnerdy

@dnerdy dnerdy commented Jun 2, 2022

Copy link
Copy Markdown
Contributor

This PR updates createBucketByPost to return a 409 response when the
bucket being created already exists. This matches the behavior of the
GCS API.

Fixes #804.

This PR updates createBucketByPost to return a 409 response when the
bucket being created already exists. This matches the behavior of the
GCS API.

Fixes fsouza#804.

@fsouza fsouza left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

Comment thread fakestorage/bucket.go
return jsonResponse{errorMessage: err.Error(), status: http.StatusBadRequest}
}

_, err := s.backend.GetBucket(name)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we should have the backend return an error or something like that (to avoid TOCTOU). This is an emulator though, I imagine TOCTOU isn't really an issue, and if it becomes an issue we can fix it x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants