From aa496cda8d16b88753b6670807ef4bb9cb94bde2 Mon Sep 17 00:00:00 2001 From: TomJKing Date: Tue, 19 Nov 2024 14:36:16 +0000 Subject: [PATCH] Ensure empty tag set is provided Need to specify when using 'x-amz-tagging-directive=REPLACE' See documentation here: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html#API_CopyObject_RequestParameters --- .../main/scala/uk/gov/nationalarchives/export/S3Utils.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/export/src/main/scala/uk/gov/nationalarchives/export/S3Utils.scala b/export/src/main/scala/uk/gov/nationalarchives/export/S3Utils.scala index ae48d696..c0b3557d 100644 --- a/export/src/main/scala/uk/gov/nationalarchives/export/S3Utils.scala +++ b/export/src/main/scala/uk/gov/nationalarchives/export/S3Utils.scala @@ -6,7 +6,7 @@ import io.circe.syntax._ import io.circe.{Json, JsonObject, Printer} import software.amazon.awssdk.core.sync.RequestBody import software.amazon.awssdk.services.s3.S3Client -import software.amazon.awssdk.services.s3.model.{CopyObjectRequest, ListObjectsV2Request, PutObjectRequest, S3Object, TaggingDirective} +import software.amazon.awssdk.services.s3.model.{CopyObjectRequest, ListObjectsV2Request, PutObjectRequest, S3Object, Tagging, TaggingDirective} import uk.gov.nationalarchives.`export`.Main.Config import uk.gov.nationalarchives.`export`.MetadataUtils.{ConsignmentType, Judgment, Metadata, Standard} import uk.gov.nationalarchives.`export`.S3Utils.FileOutput @@ -53,6 +53,7 @@ class S3Utils(config: Config, s3Client: S3Client) { .destinationKey(destinationKey) .destinationBucket(destinationBucket) .taggingDirective(TaggingDirective.REPLACE) + .tagging(Tagging.builder().build()) .build() s3Client.copyObject(copyRequest) val series = consignmentMetadata.find(_.propertyName == "Series").map(_.value)