SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix ListAllMyBucketsResult xmlns
chrislufdfa08975427
diff --git a/weed/s3api/s3api_bucket_handlers_test.go b/weed/s3api/s3api_bucket_handlers_test.goindex 3f7f3e6dec..3835c08e94 100644--- a/weed/s3api/s3api_bucket_handlers_test.go+++ b/weed/s3api/s3api_bucket_handlers_test.go@@ -2,8 +2,10 @@ package s3apiimport ("encoding/json"+ "encoding/xml""net/http/httptest""testing"+ "time""github.com/aws/aws-sdk-go/service/s3""github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"@@ -204,3 +206,45 @@ func (m *mockIamInterface) GetAccountNameById(canonicalId string) string {func (m *mockIamInterface) GetAccountIdByEmail(email string) string {return "account-for-" + email}++// TestListAllMyBucketsResultNamespace verifies that the ListAllMyBucketsResult+// XML response includes the proper S3 namespace URI+func TestListAllMyBucketsResultNamespace(t *testing.T) {+ // Create a sample ListAllMyBucketsResult response+ response := ListAllMyBucketsResult{+ Owner: CanonicalUser{+ ID: "test-owner-id",+ DisplayName: "test-owner",+ },+ Buckets: ListAllMyBucketsList{+ Bucket: []ListAllMyBucketsEntry{+ {+ Name: "test-bucket",+ CreationDate: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),+ },+ },+ },+ }++ // Marshal the response to XML+ xmlData, err := xml.Marshal(response)+ require.NoError(t, err, "Failed to marshal XML response")++ xmlString := string(xmlData)++ // Verify that the XML contains the proper namespace+ assert.Contains(t, xmlString, `xmlns="http://s3.amazonaws.com/doc/2006-03-01/"`,+ "XML response should contain the S3 namespace URI")++ // Verify the root element has the correct name+ assert.Contains(t, xmlString, "<ListAllMyBucketsResult",+ "XML response should have ListAllMyBucketsResult root element")++ // Verify structure contains expected elements+ assert.Contains(t, xmlString, "<Owner>", "XML should contain Owner element")+ assert.Contains(t, xmlString, "<Buckets>", "XML should contain Buckets element")+ assert.Contains(t, xmlString, "<Bucket>", "XML should contain Bucket element")+ assert.Contains(t, xmlString, "<Name>test-bucket</Name>", "XML should contain bucket name")++ t.Logf("Generated XML:\n%s", xmlString)+}diff --git a/weed/s3api/s3api_xsd_generated.go b/weed/s3api/s3api_xsd_generated.goindex 61b0f8de60..79300cf4fd 100644--- a/weed/s3api/s3api_xsd_generated.go+++ b/weed/s3api/s3api_xsd_generated.go@@ -1074,6 +1074,7 @@ type ListAllMyBucketsResponse struct {}type ListAllMyBucketsResult struct {+ XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult"`Owner CanonicalUser `xml:"Owner"`Buckets ListAllMyBucketsList `xml:"Buckets"`}