From 73f9d8a636aeafc31876a767d9d75a197bd2e2ff Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 2 Apr 2020 00:23:09 -0700 Subject: [PATCH] set default storage class always (#9250) gateway implementations might not respond back with right storage class which is an AWS S3 concept, add default storage if its empty. --- cmd/api-response.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cmd/api-response.go b/cmd/api-response.go index 17dcc563b..fdae6095c 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -429,7 +429,12 @@ func generateListVersionsResponse(bucket, prefix, marker, delimiter, encodingTyp content.ETag = "\"" + object.ETag + "\"" } content.Size = object.Size - content.StorageClass = object.StorageClass + if object.StorageClass != "" { + content.StorageClass = object.StorageClass + } else { + content.StorageClass = globalMinioDefaultStorageClass + } + content.Owner = owner content.VersionID = "null" content.IsLatest = true @@ -475,7 +480,11 @@ func generateListObjectsV1Response(bucket, prefix, marker, delimiter, encodingTy content.ETag = "\"" + object.ETag + "\"" } content.Size = object.Size - content.StorageClass = object.StorageClass + if object.StorageClass != "" { + content.StorageClass = object.StorageClass + } else { + content.StorageClass = globalMinioDefaultStorageClass + } content.Owner = owner contents = append(contents, content) } @@ -521,7 +530,11 @@ func generateListObjectsV2Response(bucket, prefix, token, nextToken, startAfter, content.ETag = "\"" + object.ETag + "\"" } content.Size = object.Size - content.StorageClass = object.StorageClass + if object.StorageClass != "" { + content.StorageClass = object.StorageClass + } else { + content.StorageClass = globalMinioDefaultStorageClass + } content.Owner = owner if metadata { content.UserMetadata = make(StringMap)