@ -974,6 +974,14 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
// Send 200 OK
setCommonHeaders ( w )
w . WriteHeader ( http . StatusOK )
// Xml headers need to be sent before we possibly send whitespace characters
// to the client.
_ , err = w . Write ( [ ] byte ( xml . Header ) )
if err != nil {
errorIf ( err , "Unable to write XML header for complete multipart upload" )
writeErrorResponseNoHeader ( w , r , ErrInternalError , r . URL . Path )
return
}
doneCh := make ( chan struct { } )
// Signal that completeMultipartUpload is over via doneCh
@ -992,7 +1000,7 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
writePartSmallErrorResponse ( w , r , oErr )
default :
// Handle all other generic issues.
writeErrorResponseNoHeader ( w , r , getAPIError ( toAPIErrorCode ( err ) ) , r . URL . Path )
writeErrorResponseNoHeader ( w , r , toAPIErrorCode ( err ) , r . URL . Path )
}
return
}
@ -1001,7 +1009,12 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
location := getLocation ( r )
// Generate complete multipart response.
response := generateCompleteMultpartUploadResponse ( bucket , object , location , md5Sum )
encodedSuccessResponse := encodeResponse ( response )
encodedSuccessResponse , err := xml . Marshal ( response )
if err != nil {
errorIf ( err , "Unable to parse CompleteMultipartUpload response" )
writeErrorResponseNoHeader ( w , r , ErrInternalError , r . URL . Path )
return
}
// write success response.
w . Write ( encodedSuccessResponse )
w . ( http . Flusher ) . Flush ( )