mirror of https://github.com/minio/minio.git
fs: Enable fs.json with env MINIO_ENABLE_FSMETA
This commit is contained in:
parent
51d7749c3e
commit
0e745fdb05
|
@ -18,6 +18,7 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
|
@ -161,6 +162,9 @@ func isExtendedHeader(header string) bool {
|
|||
|
||||
// Return true if extended HTTP headers are set, false otherwise.
|
||||
func hasExtendedHeader(metadata map[string]string) bool {
|
||||
if os.Getenv("MINIO_ENABLE_FSMETA") == "1" {
|
||||
return true
|
||||
}
|
||||
for k := range metadata {
|
||||
if isExtendedHeader(k) {
|
||||
return true
|
||||
|
|
|
@ -588,8 +588,13 @@ 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) {
|
||||
fsMeta.Meta["md5Sum"] = s3MD5
|
||||
uniqueID := getUUID()
|
||||
fsMetaTmp := path.Join(tmpMetaPrefix, uniqueID)
|
||||
if err = writeFSMetadata(fs.storage, minioMetaBucket, fsMetaTmp, fsMeta); err != nil {
|
||||
return "", toObjectErr(err, bucket, object)
|
||||
}
|
||||
fsMetaPath := path.Join(bucketMetaPrefix, bucket, object, fsMetaJSONFile)
|
||||
if err = writeFSMetadata(fs.storage, minioMetaBucket, fsMetaPath, fsMeta); err != nil {
|
||||
if err = fs.storage.RenameFile(minioMetaBucket, fsMetaTmp, minioMetaBucket, fsMetaPath); err != nil {
|
||||
return "", toObjectErr(err, bucket, object)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue