diff --git a/fs-v1-metadata_test.go b/fs-v1-metadata_test.go index 8fc165265..e2f9940fa 100644 --- a/fs-v1-metadata_test.go +++ b/fs-v1-metadata_test.go @@ -16,7 +16,10 @@ package main -import "testing" +import ( + "os" + "testing" +) // Tests scenarios which can occur for hasExtendedHeader function. func TestHasExtendedHeader(t *testing.T) { @@ -30,26 +33,26 @@ func TestHasExtendedHeader(t *testing.T) { metadata: map[string]string{ "X-Amz-Meta-1": "value", }, - has: true, + has: true || os.Getenv("MINIO_ENABLE_FSMETA") == "1", }, // Verifies if X-Minio-Meta is present. { metadata: map[string]string{ "X-Minio-Meta-1": "value", }, - has: true, + has: true || os.Getenv("MINIO_ENABLE_FSMETA") == "1", }, // Verifies if extended header is not present. { metadata: map[string]string{ "md5Sum": "value", }, - has: false, + has: false || os.Getenv("MINIO_ENABLE_FSMETA") == "1", }, - // Verifieis if extended header is not present, but with an empty input. + // Verifies if extended header is not present, but with an empty input. { metadata: nil, - has: false, + has: false || os.Getenv("MINIO_ENABLE_FSMETA") == "1", }, } diff --git a/fs-v1-multipart.go b/fs-v1-multipart.go index 3c19e1ca6..e38b2acb4 100644 --- a/fs-v1-multipart.go +++ b/fs-v1-multipart.go @@ -587,6 +587,9 @@ func (fs fsObjects) CompleteMultipartUpload(bucket string, object string, upload // Save additional metadata only if extended headers such as "X-Amz-Meta-" are set. if hasExtendedHeader(fsMeta.Meta) { + if len(fsMeta.Meta) == 0 { + fsMeta.Meta = make(map[string]string) + } fsMeta.Meta["md5Sum"] = s3MD5 // Write the metadata to a temp file and rename it to the actual location.