mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
change updateVersion to only update keys, no deletes (#12032)
there are situations where metadata can have keys with empty values, preserve existing behavior
This commit is contained in:
parent
d50193d30f
commit
641150f2a2
@ -623,7 +623,9 @@ func putRestoreOpts(bucket, object string, rreq *RestoreObjectRequest, objInfo O
|
||||
}
|
||||
meta[v.Name] = v.Value
|
||||
}
|
||||
meta[xhttp.AmzObjectTagging] = rreq.OutputLocation.S3.Tagging.String()
|
||||
if tags := rreq.OutputLocation.S3.Tagging.String(); tags != "" {
|
||||
meta[xhttp.AmzObjectTagging] = tags
|
||||
}
|
||||
if rreq.OutputLocation.S3.Encryption.EncryptionType != "" {
|
||||
meta[xhttp.AmzServerSideEncryption] = xhttp.AmzEncryptionAES
|
||||
}
|
||||
@ -636,7 +638,9 @@ func putRestoreOpts(bucket, object string, rreq *RestoreObjectRequest, objInfo O
|
||||
for k, v := range objInfo.UserDefined {
|
||||
meta[k] = v
|
||||
}
|
||||
if len(objInfo.UserTags) != 0 {
|
||||
meta[xhttp.AmzObjectTagging] = objInfo.UserTags
|
||||
}
|
||||
|
||||
return ObjectOptions{
|
||||
Versioned: globalBucketVersioningSys.Enabled(bucket),
|
||||
|
@ -138,7 +138,10 @@ func (fi FileInfo) ToObjectInfo(bucket, object string) ObjectInfo {
|
||||
objInfo.ETag = extractETag(fi.Metadata)
|
||||
|
||||
// Add user tags to the object info
|
||||
objInfo.UserTags = fi.Metadata[xhttp.AmzObjectTagging]
|
||||
tags := fi.Metadata[xhttp.AmzObjectTagging]
|
||||
if len(tags) != 0 {
|
||||
objInfo.UserTags = tags
|
||||
}
|
||||
|
||||
// Add replication status to the object info
|
||||
objInfo.ReplicationStatus = replication.StatusType(fi.Metadata[xhttp.AmzBucketReplicationStatus])
|
||||
|
@ -739,19 +739,11 @@ func (z *xlMetaV2) UpdateObjectVersion(fi FileInfo) error {
|
||||
if version.ObjectV2.VersionID == uv {
|
||||
for k, v := range fi.Metadata {
|
||||
if strings.HasPrefix(strings.ToLower(k), ReservedMetadataPrefixLower) {
|
||||
if v == "" {
|
||||
delete(z.Versions[i].ObjectV2.MetaSys, k)
|
||||
} else {
|
||||
z.Versions[i].ObjectV2.MetaSys[k] = []byte(v)
|
||||
}
|
||||
} else {
|
||||
if v == "" {
|
||||
delete(z.Versions[i].ObjectV2.MetaUser, k)
|
||||
} else {
|
||||
z.Versions[i].ObjectV2.MetaUser[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
if !fi.ModTime.IsZero() {
|
||||
z.Versions[i].ObjectV2.ModTime = fi.ModTime.UnixNano()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user