From 41978702877e155d324355254811c68e5b5bf497 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 3 Aug 2021 17:35:52 -0700 Subject: [PATCH] Storage-class headers should depend only on ObjectInfo state (#12864) --- cmd/api-headers.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/api-headers.go b/cmd/api-headers.go index 567bb53e2..a07de1e56 100644 --- a/cmd/api-headers.go +++ b/cmd/api-headers.go @@ -184,12 +184,13 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp w.Header()[xhttp.AmzBucketReplicationStatus] = []string{objInfo.ReplicationStatus.String()} } + if objInfo.IsRemote() { + // Check if object is being restored. For more information on x-amz-restore header see + // https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html#API_HeadObject_ResponseSyntax + w.Header()[xhttp.AmzStorageClass] = []string{objInfo.TransitionTier} + } + if lc, err := globalLifecycleSys.Get(objInfo.Bucket); err == nil { - if objInfo.IsRemote() { - // Check if object is being restored. For more information on x-amz-restore header see - // https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html#API_HeadObject_ResponseSyntax - w.Header()[xhttp.AmzStorageClass] = []string{objInfo.TransitionTier} - } lc.SetPredictionHeaders(w, objInfo.ToLifecycleOpts()) }