From 5dd9cf439810c8f37044607e31291a94acc449e2 Mon Sep 17 00:00:00 2001 From: P R <25353498+BigUstad@users.noreply.github.com> Date: Tue, 28 Apr 2020 21:56:37 -0700 Subject: [PATCH] fix: CopyObject with REPLACE directive deletes existing tags (#9478) Fixes #9477 --- cmd/object-handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index de197fcb6..d200f57f8 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -656,9 +656,9 @@ func getCpObjTagsFromHeader(ctx context.Context, r *http.Request, tags string) ( if tags := r.Header.Get(xhttp.AmzObjectTagging); tags != "" { return extractTags(ctx, tags) } - // Copy is default behavior if x-amz-tagging-directive is set, but x-amz-tagging is - // is not set - return tags, nil + // If x-amz-tagging-directive is explicitly set to replace and x-amz-tagging is not set. + // The S3 behavior is to unset the tags. + return "", nil } // Copy is default behavior if x-amz-tagging-directive is not set.