Merge pull request #1730 from versity/sis/create-bucket-location-constraint-us-east-1

fix: fixes CreateBucket LocationConstraint validation
This commit is contained in:
Ben McClelland
2026-01-03 20:52:57 -08:00
committed by GitHub
4 changed files with 25 additions and 14 deletions
+3 -3
View File
@@ -562,10 +562,10 @@ func (c S3ApiController) CreateBucket(ctx *fiber.Ctx) (*Response, error) {
}, s3err.GetAPIError(s3err.ErrMalformedXML)
}
if body.LocationConstraint != "" {
if body.LocationConstraint != nil {
region := utils.ContextKeyRegion.Get(ctx).(string)
if body.LocationConstraint != region {
debuglogger.Logf("invalid location constraint: %s", body.LocationConstraint)
if *body.LocationConstraint != region || *body.LocationConstraint == "us-east-1" {
debuglogger.Logf("invalid location constraint: %s", *body.LocationConstraint)
return &Response{
MetaOpts: &MetaOptions{
BucketOwner: acct.Access,
+1 -1
View File
@@ -700,7 +700,7 @@ func TestS3ApiController_CreateBucket(t *testing.T) {
}
invLocConstBody, err := xml.Marshal(s3response.CreateBucketConfiguration{
LocationConstraint: "us-west-1",
LocationConstraint: utils.GetStringPtr("us-west-1"),
})
assert.NoError(t, err)