Fix CopyObject with metadata for Azure gateway (#4986)

This commit is contained in:
Aditya Manthramurthy 2017-09-29 23:28:40 +05:30 committed by Dee Koder
parent b415c600e1
commit b05351c420

View File

@ -543,10 +543,17 @@ func (a *azureObjects) PutObject(bucket, object string, data *HashReader, metada
func (a *azureObjects) CopyObject(srcBucket, srcObject, destBucket, destObject string, metadata map[string]string) (objInfo ObjectInfo, err error) { func (a *azureObjects) CopyObject(srcBucket, srcObject, destBucket, destObject string, metadata map[string]string) (objInfo ObjectInfo, err error) {
srcBlobURL := a.client.GetContainerReference(srcBucket).GetBlobReference(srcObject).GetURL() srcBlobURL := a.client.GetContainerReference(srcBucket).GetBlobReference(srcObject).GetURL()
destBlob := a.client.GetContainerReference(destBucket).GetBlobReference(destObject) destBlob := a.client.GetContainerReference(destBucket).GetBlobReference(destObject)
azureMeta, props := s3MetaToAzureProperties(metadata)
destBlob.Metadata = azureMeta
err = destBlob.Copy(srcBlobURL, nil) err = destBlob.Copy(srcBlobURL, nil)
if err != nil { if err != nil {
return objInfo, azureToObjectError(traceError(err), srcBucket, srcObject) return objInfo, azureToObjectError(traceError(err), srcBucket, srcObject)
} }
destBlob.Properties = props
err = destBlob.SetProperties(nil)
if err != nil {
return objInfo, azureToObjectError(traceError(err), srcBucket, srcObject)
}
return a.GetObjectInfo(destBucket, destObject) return a.GetObjectInfo(destBucket, destObject)
} }