mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Fix Retention, ObjectLock, LegalHold struct namespaces correctly. (#8909)
Reverts #8903 to allow structs to be unmarshalled even if the namespace is missing.
This commit is contained in:
@@ -209,7 +209,8 @@ type topic struct {
|
||||
// Config - notification configuration described in
|
||||
// http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
|
||||
type Config struct {
|
||||
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ NotificationConfiguration"`
|
||||
XMLNS string `xml:"xmlns,attr,omitempty"`
|
||||
XMLName xml.Name `xml:"NotificationConfiguration"`
|
||||
QueueList []Queue `xml:"QueueConfiguration,omitempty"`
|
||||
LambdaList []lambda `xml:"CloudFunctionConfiguration,omitempty"`
|
||||
TopicList []topic `xml:"TopicConfiguration,omitempty"`
|
||||
@@ -290,6 +291,9 @@ func ParseConfig(reader io.Reader, region string, targetList *TargetList) (*Conf
|
||||
}
|
||||
|
||||
config.SetRegion(region)
|
||||
|
||||
//If xml namespace is empty, set a default value before returning.
|
||||
if config.XMLNS == "" {
|
||||
config.XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/"
|
||||
}
|
||||
return &config, nil
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ func TestConfigUnmarshalXML(t *testing.T) {
|
||||
`)
|
||||
|
||||
dataCase3 := []byte(`
|
||||
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<NotificationConfiguration>
|
||||
<QueueConfiguration>
|
||||
<Id>1</Id>
|
||||
<Filter></Filter>
|
||||
|
||||
Reference in New Issue
Block a user