mirror of
https://github.com/minio/minio.git
synced 2025-11-22 02:35:30 -05:00
handler: CopyObject should save metadata. (#1698)
- Content-Type - Content-Encoding - ETag Fixes #1682
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
00d0558131
commit
9fdb69563d
@@ -404,8 +404,16 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
|
||||
// Size of object.
|
||||
size := objInfo.Size
|
||||
|
||||
// Save metadata.
|
||||
metadata := make(map[string]string)
|
||||
// Save other metadata if available.
|
||||
metadata["content-type"] = objInfo.ContentType
|
||||
metadata["content-encoding"] = objInfo.ContentEncoding
|
||||
// Do not set `md5sum` as CopyObject will not keep the
|
||||
// same md5sum as the source.
|
||||
|
||||
// Create the object.
|
||||
md5Sum, err := api.ObjectAPI.PutObject(bucket, object, size, readCloser, nil)
|
||||
md5Sum, err := api.ObjectAPI.PutObject(bucket, object, size, readCloser, metadata)
|
||||
if err != nil {
|
||||
errorIf(err, "Unable to create an object.")
|
||||
writeErrorResponse(w, r, toAPIErrorCode(err), r.URL.Path)
|
||||
|
||||
Reference in New Issue
Block a user