Lifecycle: Accept empty <Filter> tag in XML documents (#12039)

Follow S3 to accept an empty filter tag inside an XML document.

<Filter> needs to be specified but it doesn't have to contain any other
XML tags inside it.
This commit is contained in:
Anis Elleuch
2021-04-12 17:36:15 +01:00
committed by GitHub
parent 8ab111cfb6
commit f1bc857f66
2 changed files with 11 additions and 3 deletions

View File

@@ -86,12 +86,18 @@ func TestParseAndValidateLifecycleConfig(t *testing.T) {
expectedParsingErr: nil,
expectedValidationErr: errXMLNotWellFormed,
},
// Legitimate lifecycle
// Lifecycle with the deprecated Prefix tag
{
inputConfig: `<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Rule><ID>rule</ID><Prefix /><Status>Enabled</Status><Expiration><Days>1</Days></Expiration></Rule></LifecycleConfiguration>`,
expectedParsingErr: nil,
expectedValidationErr: nil,
},
// Lifecycle with empty Filter tag
{
inputConfig: `<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Rule><ID>rule</ID><Filter></Filter><Status>Enabled</Status><Expiration><Days>1</Days></Expiration></Rule></LifecycleConfiguration>`,
expectedParsingErr: nil,
expectedValidationErr: nil,
},
}
for i, tc := range testCases {