@ -260,7 +260,7 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
// Extract metadata relevant for an CopyObject operation based on conditional
// header values specified in X-Amz-Metadata-Directive.
func getCpObjMetadataFromHeader ( header http . Header , defaultMeta map [ string ] string ) map [ string ] string {
func getCpObjMetadataFromHeader ( header http . Header , defaultMeta map [ string ] string ) ( map [ string ] string , error ) {
// if x-amz-metadata-directive says REPLACE then
// we extract metadata from the input headers.
if isMetadataReplace ( header ) {
@ -270,11 +270,11 @@ func getCpObjMetadataFromHeader(header http.Header, defaultMeta map[string]strin
// if x-amz-metadata-directive says COPY then we
// return the default metadata.
if isMetadataCopy ( header ) {
return defaultMeta
return defaultMeta , nil
}
// Copy is default behavior if not x-amz-metadata-directive is set.
return defaultMeta
return defaultMeta , nil
}
// CopyObjectHandler - Copy Object
@ -363,7 +363,11 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
// Make sure to remove saved etag, CopyObject calculates a new one.
delete ( defaultMeta , "etag" )
newMetadata := getCpObjMetadataFromHeader ( r . Header , defaultMeta )
newMetadata , err := getCpObjMetadataFromHeader ( r . Header , defaultMeta )
if err != nil {
errorIf ( err , "found invalid http request header" )
writeErrorResponse ( w , ErrInternalError , r . URL )
}
// Check if x-amz-metadata-directive was not set to REPLACE and source,
// desination are same objects.
if ! isMetadataReplace ( r . Header ) && cpSrcDstSame {
@ -457,7 +461,12 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
}
// Extract metadata to be saved from incoming HTTP header.
metadata := extractMetadataFromHeader ( r . Header )
metadata , err := extractMetadataFromHeader ( r . Header )
if err != nil {
errorIf ( err , "found invalid http request header" )
writeErrorResponse ( w , ErrInternalError , r . URL )
return
}
if rAuthType == authTypeStreamingSigned {
if contentEncoding , ok := metadata [ "content-encoding" ] ; ok {
contentEncoding = trimAwsChunkedContentEncoding ( contentEncoding )
@ -579,7 +588,12 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
}
// Extract metadata that needs to be saved.
metadata := extractMetadataFromHeader ( r . Header )
metadata , err := extractMetadataFromHeader ( r . Header )
if err != nil {
errorIf ( err , "found invalid http request header" )
writeErrorResponse ( w , ErrInternalError , r . URL )
return
}
uploadID , err := objectAPI . NewMultipartUpload ( bucket , object , metadata )
if err != nil {