From e8e07147a8d7444c927d7b4f60fb577eeb1082ad Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 17 Jan 2022 16:08:36 +0300 Subject: [PATCH] [#318] Add x-amz-version-id header Support version id in CompleteMultipartUpload method Signed-off-by: Denis Kirillov --- api/handler/multipart_upload.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/handler/multipart_upload.go b/api/handler/multipart_upload.go index 3a1f731f5..cb466b106 100644 --- a/api/handler/multipart_upload.go +++ b/api/handler/multipart_upload.go @@ -458,6 +458,12 @@ func (h *handler) CompleteMultipartUploadHandler(w http.ResponseWriter, r *http. Key: objInfo.Name, } + if versioning, err := h.obj.GetBucketVersioning(r.Context(), reqInfo.BucketName); err != nil { + h.log.Warn("couldn't get bucket versioning", zap.String("bucket name", reqInfo.BucketName), zap.Error(err)) + } else if versioning.VersioningEnabled { + w.Header().Set(api.AmzVersionID, objInfo.Version()) + } + if err = api.EncodeToResponse(w, response); err != nil { h.logAndSendError(w, "something went wrong", reqInfo, err) }