site-repl: Fix ILM document replication in some cases (#20380)

S3 spec does not accept an ILM XML document containing both <Filter>
and <Prefix> XML tags, even if both are empty. That is why we added
a 'set' field in some lifecycle structures to decide when and when not to
show a tag. However, we forgot to disallow marshaling of Filter when
'set' is set to false.

This will fix ILM document replication in a site replication
configuration in some cases.
This commit is contained in:
Anis Eleuch 2024-09-04 18:01:26 +01:00 committed by GitHub
parent c2e318dd40
commit 9b79eec29e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,6 +49,10 @@ type Filter struct {
// MarshalXML - produces the xml representation of the Filter struct
// only one of Prefix, And and Tag should be present in the output.
func (f Filter) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if !f.set {
return nil
}
if err := e.EncodeToken(start); err != nil {
return err
}