fix(webui): send the LocationConstraint when creating a bucket outside us-east-1

CreateBucket was sent with an empty body, so on a gateway with any region
other than us-east-1 both the bucket dialog and the explorer failed with
IllegalLocationConstraintException. Send a CreateBucketConfiguration
naming the signing region, which the gateway requires to be its own, for
the S3 and the admin create-bucket call alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Christian Schmitt
2026-10-21 17:51:16 +02:00
co-authored by Claude Opus 5.5
parent b4f02dcc97
commit c07ffdc315
+18 -2
View File
@@ -1211,7 +1211,7 @@ class VersityAPI {
'PATCH',
`/${bucketName}/create`,
{},
'',
this.createBucketConfiguration(),
true, // useAdminEndpoint
'application/xml',
headers
@@ -1249,13 +1249,29 @@ class VersityAPI {
'PUT',
`/${bucketName}`,
{},
'',
this.createBucketConfiguration(),
false,
'application/xml',
headers
);
}
/**
* CreateBucketConfiguration body for CreateBucket. us-east-1 is the global
* endpoint and takes no LocationConstraint; any other region requires one
* naming it. The gateway only accepts CreateBucket signed for its own
* region, so the signing region is the one to name.
*/
createBucketConfiguration() {
if (!this.region || this.region === 'us-east-1') {
return '';
}
return `<?xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>${this.escapeXml(this.region)}</LocationConstraint>
</CreateBucketConfiguration>`;
}
/**
* Delete a bucket (S3 DeleteBucket)
*/