diff --git a/webui/web/js/api.js b/webui/web/js/api.js index 9ca59121..f8f87d7d 100644 --- a/webui/web/js/api.js +++ b/webui/web/js/api.js @@ -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 ` + + ${this.escapeXml(this.region)} +`; + } + /** * Delete a bucket (S3 DeleteBucket) */