From 1340281cb87aa12a074b5528bbc4aed8e9f71630 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 23 Jul 2020 16:01:25 +0100 Subject: [PATCH] Fix marshaling expiration field in lifecycle (#10117) --- pkg/bucket/lifecycle/expiration.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/bucket/lifecycle/expiration.go b/pkg/bucket/lifecycle/expiration.go index 7dbd472e4..6037c6529 100644 --- a/pkg/bucket/lifecycle/expiration.go +++ b/pkg/bucket/lifecycle/expiration.go @@ -49,11 +49,11 @@ func (eDays *ExpirationDays) UnmarshalXML(d *xml.Decoder, startElement xml.Start // MarshalXML encodes number of days to expire if it is non-zero and // encodes empty string otherwise -func (eDays *ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { - if *eDays == ExpirationDays(0) { +func (eDays ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { + if eDays == 0 { return nil } - return e.EncodeElement(int(*eDays), startElement) + return e.EncodeElement(int(eDays), startElement) } // ExpirationDate is a embedded type containing time.Time to unmarshal @@ -90,8 +90,8 @@ func (eDate *ExpirationDate) UnmarshalXML(d *xml.Decoder, startElement xml.Start // MarshalXML encodes expiration date if it is non-zero and encodes // empty string otherwise -func (eDate *ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { - if *eDate == (ExpirationDate{time.Time{}}) { +func (eDate ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { + if eDate.Time.IsZero() { return nil } return e.EncodeElement(eDate.Format(time.RFC3339), startElement)