From 9b79eec29e28548bf67c9dc1a8b315151f3eec34 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Wed, 4 Sep 2024 18:01:26 +0100 Subject: [PATCH] site-repl: Fix ILM document replication in some cases (#20380) S3 spec does not accept an ILM XML document containing both and 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. --- internal/bucket/lifecycle/filter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/bucket/lifecycle/filter.go b/internal/bucket/lifecycle/filter.go index 446397a50..6e605d3e3 100644 --- a/internal/bucket/lifecycle/filter.go +++ b/internal/bucket/lifecycle/filter.go @@ -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 }