diff --git a/backend.go b/backend.go index b72f604..298c57e 100644 --- a/backend.go +++ b/backend.go @@ -321,7 +321,7 @@ type MultipartBackend interface { ListParts(ctx context.Context, bucket, object string, uploadID UploadID, marker int, limit int64) (*ListMultipartUploadPartsResult, error) AbortMultipartUpload(ctx context.Context, bucket, object string, id UploadID) error - CompleteMultipartUpload(ctx context.Context, bucket, object string, id UploadID, input *CompleteMultipartUploadRequest) (*CompleteMultipartUploadResult, error) + CompleteMultipartUpload(ctx context.Context, bucket, object string, id UploadID, meta map[string]string, input *CompleteMultipartUploadRequest) (*CompleteMultipartUploadResult, error) } type AuthenticatedBackend interface { diff --git a/gofakes3.go b/gofakes3.go index 98e4dc5..d0189b0 100644 --- a/gofakes3.go +++ b/gofakes3.go @@ -970,7 +970,12 @@ func (g *GoFakeS3) completeMultipartUpload(bucket, object string, uploadID Uploa return err } - res, err := g.uploader.CompleteMultipartUpload(r.Context(), bucket, object, uploadID, &in) + meta, err := metadataHeaders(r.Header, g.timeSource.Now(), g.metadataSizeLimit) + if err != nil { + return err + } + + res, err := g.uploader.CompleteMultipartUpload(r.Context(), bucket, object, uploadID, meta, &in) if err != nil { return err } diff --git a/uploader.go b/uploader.go index c4f4718..6536b5f 100644 --- a/uploader.go +++ b/uploader.go @@ -404,12 +404,16 @@ func (u *uploader) UploadPart(_ context.Context, bucket, object string, id Uploa return &UploadPartResult{ETag: etag}, nil } -func (u *uploader) CompleteMultipartUpload(ctx context.Context, bucket, object string, id UploadID, input *CompleteMultipartUploadRequest) (*CompleteMultipartUploadResult, error) { +func (u *uploader) CompleteMultipartUpload(ctx context.Context, bucket, object string, id UploadID, meta map[string]string, input *CompleteMultipartUploadRequest) (*CompleteMultipartUploadResult, error) { mpu, err := u.getUnlocked(bucket, object, id) if err != nil { return nil, err } + for k, v := range meta { + mpu.Meta[k] = v + } + mpu.mu.Lock() defer mpu.mu.Unlock()