From 16ce7fb70c379505de60797f1a7d008960ab096e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 8 Apr 2021 14:29:27 -0700 Subject: [PATCH] fix: legacy object should be overwritten for metadataOnly updates (#12012) --- cmd/object-handlers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index e8e2e573e..e72a1c831 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -1273,6 +1273,11 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re // Ensure that metadata does not contain sensitive information crypto.RemoveSensitiveEntries(srcInfo.UserDefined) + // If we see legacy source, metadataOnly we have to overwrite the content. + if srcInfo.Legacy { + srcInfo.metadataOnly = false + } + // Check if x-amz-metadata-directive or x-amz-tagging-directive was not set to REPLACE and source, // destination are same objects. Apply this restriction also when // metadataOnly is true indicating that we are not overwriting the object.