Save ETag when updating metadata (#5626)

Fixes #5622
master
Harshavardhana 7 years ago committed by kannappanr
parent ba0c7544ea
commit 7aaf01eb74
  1. 1
      cmd/fs-v1.go
  2. 3
      cmd/object-handlers.go
  3. 1
      cmd/xl-v1-object.go

@ -403,6 +403,7 @@ func (fs *FSObjects) CopyObject(srcBucket, srcObject, dstBucket, dstObject strin
} }
fsMeta.Meta = srcInfo.UserDefined fsMeta.Meta = srcInfo.UserDefined
fsMeta.Meta["etag"] = srcInfo.ETag
if _, err = fsMeta.WriteTo(wlk); err != nil { if _, err = fsMeta.WriteTo(wlk); err != nil {
return oi, toObjectErr(err, srcBucket, srcObject) return oi, toObjectErr(err, srcBucket, srcObject)
} }

@ -483,9 +483,6 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
srcInfo.UserDefined[k] = v srcInfo.UserDefined[k] = v
} }
// Make sure to remove saved etag if any, CopyObject calculates a new one.
delete(srcInfo.UserDefined, "etag")
// Check if x-amz-metadata-directive was not set to REPLACE and source, // Check if x-amz-metadata-directive was not set to REPLACE and source,
// desination are same objects. Apply this restriction also when // desination are same objects. Apply this restriction also when
// metadataOnly is true indicating that we are not overwriting the object. // metadataOnly is true indicating that we are not overwriting the object.

@ -114,6 +114,7 @@ func (xl xlObjects) CopyObject(srcBucket, srcObject, dstBucket, dstObject string
// Update `xl.json` content on each disks. // Update `xl.json` content on each disks.
for index := range metaArr { for index := range metaArr {
metaArr[index].Meta = srcInfo.UserDefined metaArr[index].Meta = srcInfo.UserDefined
metaArr[index].Meta["etag"] = srcInfo.ETag
} }
var onlineDisks []StorageAPI var onlineDisks []StorageAPI

Loading…
Cancel
Save