Browse Source

Added XMLNS field setting in both places

pull/7517/head
chrislu 2 weeks ago
parent
commit
20199490d6
  1. 5
      weed/s3api/s3_constants/header.go
  2. 6
      weed/s3api/s3api_bucket_handlers_object_lock_config.go
  3. 8
      weed/s3api/s3api_object_retention.go

5
weed/s3api/s3_constants/header.go

@ -23,6 +23,11 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
// S3 XML namespace
const (
S3Namespace = "http://s3.amazonaws.com/doc/2006-03-01/"
)
// Standard S3 HTTP request constants // Standard S3 HTTP request constants
const ( const (
// S3 storage class // S3 storage class

6
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 // Check if we have cached Object Lock configuration
if bucketConfig.ObjectLockConfig != nil { 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 // Use cached configuration and marshal it to XML for response
marshaledXML, err := xml.Marshal(bucketConfig.ObjectLockConfig) marshaledXML, err := xml.Marshal(bucketConfig.ObjectLockConfig)
if err != nil { if err != nil {
@ -139,6 +142,9 @@ func (s3a *S3ApiServer) GetObjectLockConfigurationHandler(w http.ResponseWriter,
// not just ObjectLockConfig, before resetting the TTL // not just ObjectLockConfig, before resetting the TTL
s3a.updateBucketConfigCacheFromEntry(freshEntry) s3a.updateBucketConfigCacheFromEntry(freshEntry)
// Set namespace for S3 compatibility
objectLockConfig.XMLNS = s3_constants.S3Namespace
// Marshal and return the configuration // Marshal and return the configuration
marshaledXML, err := xml.Marshal(objectLockConfig) marshaledXML, err := xml.Marshal(objectLockConfig)
if err != nil { if err != nil {

8
weed/s3api/s3api_object_retention.go

@ -248,8 +248,8 @@ func (s3a *S3ApiServer) getObjectRetention(bucket, object, versionId string) (*O
return nil, ErrNoRetentionConfiguration 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 return retention, nil
} }
@ -391,8 +391,8 @@ func (s3a *S3ApiServer) getObjectLegalHold(bucket, object, versionId string) (*O
return nil, ErrNoLegalHoldConfiguration 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 return legalHold, nil
} }

Loading…
Cancel
Save