From 07f44784e025d2478b9f572bfd30bbfecf296492 Mon Sep 17 00:00:00 2001 From: Justin James Date: Fri, 4 Dec 2020 22:31:51 -0500 Subject: [PATCH] [#6] Only send x-amz-metadata-directive on CopyObject See: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html and https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html --- src/request.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/request.c b/src/request.c index 1337734..8103eac 100644 --- a/src/request.c +++ b/src/request.c @@ -401,9 +401,12 @@ static S3Status compose_amz_headers(const RequestParams *params, (unsigned long long) params->startByte, (unsigned long long) (params->startByte + params->byteCount - 1) ); } - // And the x-amz-metadata-directive header - if (properties) { - headers_append(1, "%s", "x-amz-metadata-directive: REPLACE"); + else { + // Add the x-amz-metadata-directive header + // Only for CopyObject, not UploadPartCopy (above) + if (properties) { + headers_append(1, "%s", "x-amz-metadata-directive: REPLACE"); + } } }