From cc46a99f970d1fe407e87271dfb9e1d3d2d03e84 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 1 Mar 2022 11:04:47 -0800 Subject: [PATCH] skip object-lock headers without values (#14430) metadata headers can have headers without values as per AWS S3 spec however, we need to skip some headers that do not have values that potentially can have empty values set. --- cmd/api-headers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/api-headers.go b/cmd/api-headers.go index a847fac63..2a8b2ab04 100644 --- a/cmd/api-headers.go +++ b/cmd/api-headers.go @@ -126,6 +126,11 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp // Set all other user defined metadata. for k, v := range objInfo.UserDefined { + // Empty values for object lock and retention can be skipped. + if v == "" && equals(k, xhttp.AmzObjectLockMode, xhttp.AmzObjectLockRetainUntilDate) { + continue + } + if strings.HasPrefix(strings.ToLower(k), ReservedMetadataPrefixLower) { // Do not need to send any internal metadata // values to client.