From 02331a612c6fd1e2b4fb7028605bada9564efa21 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Sat, 18 Nov 2023 19:12:44 -0800 Subject: [PATCH] batch-repl: Replicate missing metadata and standard headers (#18484) - Replicate Expires when the source is local or remote - Replicate metadata when the source is remote --- cmd/api-response.go | 2 ++ cmd/batch-handlers.go | 4 ++++ cmd/bucket-replication.go | 1 + go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/api-response.go b/cmd/api-response.go index 00c769552..14ccb666e 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -561,6 +561,7 @@ func generateListVersionsResponse(bucket, prefix, marker, versionIDMarker, delim } content.UserMetadata.Set(k, v) } + content.UserMetadata.Set("expires", object.Expires.Format(http.TimeFormat)) content.Internal = &ObjectInternalInfo{ K: object.DataBlocks, M: object.ParityBlocks, @@ -704,6 +705,7 @@ func generateListObjectsV2Response(bucket, prefix, token, nextToken, startAfter, } content.UserMetadata.Set(k, v) } + content.UserMetadata.Set("expires", object.Expires.Format(http.TimeFormat)) content.Internal = &ObjectInternalInfo{ K: object.DataBlocks, M: object.ParityBlocks, diff --git a/cmd/batch-handlers.go b/cmd/batch-handlers.go index b5a91f51f..7c93a4b17 100644 --- a/cmd/batch-handlers.go +++ b/cmd/batch-handlers.go @@ -520,6 +520,10 @@ func toObjectInfo(bucket, object string, objInfo miniogo.ObjectInfo) ObjectInfo oi.UserDefined[xhttp.AmzStorageClass] = objInfo.StorageClass } + for k, v := range objInfo.UserMetadata { + oi.UserDefined[k] = v + } + return oi } diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index 2cea01752..65b58812c 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -777,6 +777,7 @@ func putReplicationOpts(ctx context.Context, sc string, objInfo ObjectInfo) (put UserMetadata: meta, ContentType: objInfo.ContentType, ContentEncoding: objInfo.ContentEncoding, + Expires: objInfo.Expires, StorageClass: sc, Internal: minio.AdvancedPutOptions{ SourceVersionID: objInfo.VersionID, diff --git a/go.mod b/go.mod index 66280a181..29d3704fc 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/minio/highwayhash v1.0.2 github.com/minio/kes-go v0.2.0 github.com/minio/madmin-go/v3 v3.0.29 - github.com/minio/minio-go/v7 v7.0.64-0.20230920204636-e783c9ba11b3 + github.com/minio/minio-go/v7 v7.0.64-0.20231119012610-6eebdd6d5eba github.com/minio/mux v1.9.0 github.com/minio/pkg/v2 v2.0.3-0.20231107172951-8a60b89ec9b4 github.com/minio/selfupdate v0.6.0 diff --git a/go.sum b/go.sum index 4ef465340..d00590787 100644 --- a/go.sum +++ b/go.sum @@ -485,8 +485,8 @@ github.com/minio/mc v0.0.0-20231030184332-9f2fb2b6a9f8/go.mod h1:SoPU55ntH5d6IEq github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v6 v6.0.46/go.mod h1:qD0lajrGW49lKZLtXKtCB4X/qkMf0a5tBvN2PaZg7Gg= -github.com/minio/minio-go/v7 v7.0.64-0.20230920204636-e783c9ba11b3 h1:0DtfDxg67S/IRcGnIBKgzyjZ0GXyk3jN1Fy5/+8CQlM= -github.com/minio/minio-go/v7 v7.0.64-0.20230920204636-e783c9ba11b3/go.mod h1:Q6X7Qjb7WMhvG65qKf4gUgA5XaiSox74kR1uAEjxRS4= +github.com/minio/minio-go/v7 v7.0.64-0.20231119012610-6eebdd6d5eba h1:OF4FT9fUnXReMpMLQyoydIYJYPN3W3omFuD/TTL8cZg= +github.com/minio/minio-go/v7 v7.0.64-0.20231119012610-6eebdd6d5eba/go.mod h1:R4WVUR6ZTedlCcGwZRauLMIKjgyaWxhs4Mqi/OMPmEc= github.com/minio/mux v1.9.0 h1:dWafQFyEfGhJvK6AwLOt83bIG5bxKxKJnKMCi0XAaoA= github.com/minio/mux v1.9.0/go.mod h1:1pAare17ZRL5GpmNL+9YmqHoWnLmMZF9C/ioUCfy0BQ= github.com/minio/pkg v1.7.5 h1:UOUJjewE5zoaDPlCMJtNx/swc1jT1ZR+IajT7hrLd44=