From 20199490d611e2cd39522a5be23e4c964d5c5267 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 20 Nov 2025 10:48:07 -0800 Subject: [PATCH] Added XMLNS field setting in both places --- weed/s3api/s3_constants/header.go | 5 +++++ weed/s3api/s3api_bucket_handlers_object_lock_config.go | 6 ++++++ weed/s3api/s3api_object_retention.go | 8 ++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/weed/s3api/s3_constants/header.go b/weed/s3api/s3_constants/header.go index e4c0ad77b..1ef6f62c5 100644 --- a/weed/s3api/s3_constants/header.go +++ b/weed/s3api/s3_constants/header.go @@ -23,6 +23,11 @@ import ( "github.com/gorilla/mux" ) +// S3 XML namespace +const ( + S3Namespace = "http://s3.amazonaws.com/doc/2006-03-01/" +) + // Standard S3 HTTP request constants const ( // S3 storage class diff --git a/weed/s3api/s3api_bucket_handlers_object_lock_config.go b/weed/s3api/s3api_bucket_handlers_object_lock_config.go index c779f80d7..23b52648e 100644 --- a/weed/s3api/s3api_bucket_handlers_object_lock_config.go +++ b/weed/s3api/s3api_bucket_handlers_object_lock_config.go @@ -86,6 +86,9 @@ func (s3a *S3ApiServer) GetObjectLockConfigurationHandler(w http.ResponseWriter, // Check if we have cached Object Lock configuration if bucketConfig.ObjectLockConfig != nil { + // Set namespace for S3 compatibility + bucketConfig.ObjectLockConfig.XMLNS = s3_constants.S3Namespace + // Use cached configuration and marshal it to XML for response marshaledXML, err := xml.Marshal(bucketConfig.ObjectLockConfig) if err != nil { @@ -139,6 +142,9 @@ func (s3a *S3ApiServer) GetObjectLockConfigurationHandler(w http.ResponseWriter, // not just ObjectLockConfig, before resetting the TTL s3a.updateBucketConfigCacheFromEntry(freshEntry) + // Set namespace for S3 compatibility + objectLockConfig.XMLNS = s3_constants.S3Namespace + // Marshal and return the configuration marshaledXML, err := xml.Marshal(objectLockConfig) if err != nil { diff --git a/weed/s3api/s3api_object_retention.go b/weed/s3api/s3api_object_retention.go index 3479415fa..ef298eb43 100644 --- a/weed/s3api/s3api_object_retention.go +++ b/weed/s3api/s3api_object_retention.go @@ -248,8 +248,8 @@ func (s3a *S3ApiServer) getObjectRetention(bucket, object, versionId string) (*O return nil, ErrNoRetentionConfiguration } - // Set namespace for S3 compatibility (matches MinIO behavior) - retention.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/" + // Set namespace for S3 compatibility + retention.XMLNS = s3_constants.S3Namespace return retention, nil } @@ -391,8 +391,8 @@ func (s3a *S3ApiServer) getObjectLegalHold(bucket, object, versionId string) (*O return nil, ErrNoLegalHoldConfiguration } - // Set namespace for S3 compatibility (matches MinIO behavior) - legalHold.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/" + // Set namespace for S3 compatibility + legalHold.XMLNS = s3_constants.S3Namespace return legalHold, nil }