@ -124,7 +124,7 @@ func (api objectAPIHandlers) SelectObjectContentHandler(w http.ResponseWriter, r
}
_ , err := getObjectInfo ( ctx , bucket , object , ObjectOptions { } )
if toAPIErrorCode ( err ) == ErrNoSuchKey {
if toAPIErrorCode ( ctx , err ) == ErrNoSuchKey {
s3Error = ErrNoSuchKey
}
}
@ -166,7 +166,7 @@ func (api objectAPIHandlers) SelectObjectContentHandler(w http.ResponseWriter, r
gr , err := getObjectNInfo ( ctx , bucket , object , nil , r . Header , readLock , ObjectOptions { } )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
defer gr . Close ( )
@ -257,14 +257,14 @@ func (api objectAPIHandlers) SelectObjectContentHandler(w http.ResponseWriter, r
s3s , err := s3select . New ( reader , objInfo . GetActualSize ( ) , selectReq )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
// Parses the select query and checks for an error
_ , _ , _ , _ , _ , _ , err = s3select . ParseSelect ( s3s )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -343,7 +343,7 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
}
_ , err := getObjectInfo ( ctx , bucket , object , opts )
if toAPIErrorCode ( err ) == ErrNoSuchKey {
if toAPIErrorCode ( ctx , err ) == ErrNoSuchKey {
s3Error = ErrNoSuchKey
}
}
@ -377,7 +377,7 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
gr , err := getObjectNInfo ( ctx , bucket , object , rs , r . Header , readLock , opts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
defer gr . Close ( )
@ -386,7 +386,7 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
if objectAPI . IsEncryptionSupported ( ) {
if _ , err = DecryptObjectInfo ( objInfo , r . Header ) ; err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -409,8 +409,8 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
}
}
if hErr : = setObjectHeaders ( w , objInfo , rs ) ; hE rr != nil {
writeErrorResponse ( w , toAPIErrorCode ( hE rr) , r . URL )
if err = setObjectHeaders ( w , objInfo , rs ) ; e rr != nil {
writeErrorResponse ( w , toAPIErrorCode ( ctx , e rr) , r . URL )
return
}
@ -426,14 +426,14 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
// Write object content to response body
if _ , err = io . Copy ( httpWriter , gr ) ; err != nil {
if ! httpWriter . HasWritten ( ) && ! statusCodeWritten { // write error response only if no data or headers has been written to client yet
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
}
return
}
if err = httpWriter . Close ( ) ; err != nil {
if ! httpWriter . HasWritten ( ) && ! statusCodeWritten { // write error response only if no data or headers has been written to client yet
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -507,7 +507,7 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
IsOwner : false ,
} ) {
_ , err := getObjectInfo ( ctx , bucket , object , opts )
if toAPIErrorCode ( err ) == ErrNoSuchKey {
if toAPIErrorCode ( ctx , err ) == ErrNoSuchKey {
s3Error = ErrNoSuchKey
}
}
@ -536,13 +536,13 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
objInfo , err := getObjectInfo ( ctx , bucket , object , opts )
if err != nil {
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( err ) )
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( ctx , err ) )
return
}
if objectAPI . IsEncryptionSupported ( ) {
if _ , err = DecryptObjectInfo ( objInfo , r . Header ) ; err != nil {
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( err ) )
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( ctx , err ) )
return
}
}
@ -556,7 +556,7 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
case crypto . SSEC . IsEncrypted ( objInfo . UserDefined ) :
// Validate the SSE-C Key set in the header.
if _ , err = crypto . SSEC . UnsealObjectKey ( r . Header , objInfo . UserDefined , bucket , object ) ; err != nil {
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( err ) )
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( ctx , err ) )
return
}
w . Header ( ) . Set ( crypto . SSECAlgorithm , r . Header . Get ( crypto . SSECAlgorithm ) )
@ -571,8 +571,8 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
}
// Set standard object headers.
if hErr : = setObjectHeaders ( w , objInfo , rs ) ; hE rr != nil {
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( hE rr) )
if err = setObjectHeaders ( w , objInfo , rs ) ; e rr != nil {
writeErrorResponseHeadersOnly ( w , toAPIErrorCode ( ctx , e rr) )
return
}
@ -716,7 +716,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
var rs * HTTPRangeSpec
gr , err := getObjectNInfo ( ctx , srcBucket , srcObject , rs , r . Header , lock , srcOpts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
defer gr . Close ( )
@ -758,7 +758,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if crypto . IsEncrypted ( srcInfo . UserDefined ) {
actualSize , err = srcInfo . DecryptedSize ( )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -797,7 +797,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
srcInfo . Reader , err = hash . NewReader ( reader , length , "" , "" , actualSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -805,7 +805,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if objectAPI . IsEncryptionSupported ( ) && ! isCompressed {
// Encryption parameters not applicable for this object.
if ! crypto . IsEncrypted ( srcInfo . UserDefined ) && crypto . SSECopy . IsRequested ( r . Header ) {
writeErrorResponse ( w , toAPIErrorCode ( errInvalidEncryptionParameters ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , errInvalidEncryptionParameters ) , r . URL )
return
}
// Encryption parameters not present for this object.
@ -825,7 +825,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if sseC {
newKey , err = ParseSSECustomerRequest ( r )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -838,7 +838,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if sseCopyC && sseC {
oldKey , err = ParseSSECopyCustomerRequest ( r . Header , srcInfo . UserDefined )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -848,7 +848,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
// In case of SSE-S3 oldKey and newKey aren't used - the KMS manages the keys.
if err = rotateKey ( oldKey , newKey , srcBucket , srcObject , encMetadata ) ; err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -880,7 +880,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
if isTargetEncrypted {
reader , err = newEncryptReader ( reader , newKey , dstBucket , dstObject , encMetadata , sseS3 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -893,7 +893,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
srcInfo . Reader , err = hash . NewReader ( reader , targetSize , "" , "" , targetSize ) // do not try to verify encrypted content
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -966,7 +966,7 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
// object is same then only metadata is updated.
objInfo , err = objectAPI . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1059,7 +1059,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
}
size , err = strconv . ParseInt ( sizeStr [ 0 ] , 10 , 64 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1154,7 +1154,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
var actualReader * hash . Reader
actualReader , err = hash . NewReader ( reader , size , md5hex , sha256hex , actualSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1174,7 +1174,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
hashReader , err := hash . NewReader ( reader , size , md5hex , sha256hex , actualSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
opts := ObjectOptions { }
@ -1190,13 +1190,13 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
if hasServerSideEncryptionHeader ( r . Header ) && ! hasSuffix ( object , slashSeparator ) { // handle SSE requests
reader , err = EncryptRequest ( hashReader , r , bucket , object , metadata )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
info := ObjectInfo { Size : size }
hashReader , err = hash . NewReader ( reader , info . EncryptedSize ( ) , "" , "" , size ) // do not try to verify encrypted content
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1212,7 +1212,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
// Create the object..
objInfo , err := putObject ( ctx , bucket , object , hashReader , metadata , opts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1309,7 +1309,7 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
if objectAPI . IsEncryptionSupported ( ) {
if hasServerSideEncryptionHeader ( r . Header ) {
if err := setEncryptionMetadata ( r , bucket , object , encMetadata ) ; err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
// Set this for multipart only operations, we need to differentiate during
@ -1345,7 +1345,7 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
}
uploadID , err := newMultipartUpload ( ctx , bucket , object , metadata , opts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1447,7 +1447,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
gr , err := getObjectNInfo ( ctx , srcBucket , srcObject , rs , r . Header , readLock , srcOpts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
defer gr . Close ( )
@ -1457,7 +1457,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
if crypto . IsEncrypted ( srcInfo . UserDefined ) {
actualPartSize , err = srcInfo . DecryptedSize ( )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1476,7 +1476,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
// Get the object offset & length
startOffset , length , err := rs . GetOffsetLength ( actualPartSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1492,7 +1492,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
var li ListPartsInfo
li , err = objectAPI . ListObjectParts ( ctx , dstBucket , dstObject , uploadID , 0 , 1 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1522,7 +1522,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
srcInfo . Reader , err = hash . NewReader ( reader , length , "" , "" , actualPartSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1540,14 +1540,14 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
if crypto . SSEC . IsRequested ( r . Header ) {
key , err = ParseSSECustomerRequest ( r )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
var objectEncryptionKey [ ] byte
objectEncryptionKey , err = decryptObjectInfo ( key , dstBucket , dstObject , li . UserDefined )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1559,14 +1559,14 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
partEncryptionKey := mac . Sum ( nil )
reader , err = sio . EncryptReader ( reader , sio . Config { Key : partEncryptionKey } )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
info := ObjectInfo { Size : length }
srcInfo . Reader , err = hash . NewReader ( reader , info . EncryptedSize ( ) , "" , "" , length )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1577,7 +1577,7 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
partInfo , err := objectAPI . CopyObjectPart ( ctx , srcBucket , srcObject , dstBucket , dstObject , uploadID , partID ,
startOffset , length , srcInfo , srcOpts , dstOpts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1634,7 +1634,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
}
size , err = strconv . ParseInt ( sizeStr [ 0 ] , 10 , 64 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1709,7 +1709,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
var li ListPartsInfo
li , err = objectAPI . ListObjectParts ( ctx , bucket , object , uploadID , 0 , 1 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
// Read compression metadata preserved in the init multipart for the decision.
@ -1723,7 +1723,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
var actualReader * hash . Reader
actualReader , err = hash . NewReader ( reader , size , md5hex , sha256hex , actualSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1744,7 +1744,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
hashReader , err := hash . NewReader ( reader , size , md5hex , sha256hex , actualSize )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1762,7 +1762,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
var li ListPartsInfo
li , err = objectAPI . ListObjectParts ( ctx , bucket , object , uploadID , 0 , 1 )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
if crypto . IsEncrypted ( li . UserDefined ) {
@ -1775,7 +1775,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
if crypto . SSEC . IsRequested ( r . Header ) {
key , err = ParseSSECustomerRequest ( r )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1784,7 +1784,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
var objectEncryptionKey [ ] byte
objectEncryptionKey , err = decryptObjectInfo ( key , bucket , object , li . UserDefined )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1797,14 +1797,14 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
reader , err = sio . EncryptReader ( hashReader , sio . Config { Key : partEncryptionKey } )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
info := ObjectInfo { Size : size }
hashReader , err = hash . NewReader ( reader , info . EncryptedSize ( ) , "" , "" , size ) // do not try to verify encrypted content
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
}
@ -1817,7 +1817,7 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
partInfo , err := putObjectPart ( ctx , bucket , object , uploadID , partID , hashReader , opts )
if err != nil {
// Verify if the underlying error is signature mismatch.
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
if isCompressed {
@ -1871,7 +1871,7 @@ func (api objectAPIHandlers) AbortMultipartUploadHandler(w http.ResponseWriter,
return
}
if err := abortMultipartUpload ( ctx , bucket , object , uploadID ) ; err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
@ -1914,7 +1914,7 @@ func (api objectAPIHandlers) ListObjectPartsHandler(w http.ResponseWriter, r *ht
}
listPartsInfo , err := objectAPI . ListObjectParts ( ctx , bucket , object , uploadID , partNumberMarker , maxParts )
if err != nil {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
return
}
response := generateListPartsResponse ( listPartsInfo )
@ -2003,7 +2003,7 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
writePartSmallErrorResponse ( w , r , oErr )
default :
// Handle all other generic issues.
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
}
return
}
@ -2080,7 +2080,7 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
if err == dns . ErrNoEntriesFound {
writeErrorResponse ( w , ErrNoSuchBucket , r . URL )
} else {
writeErrorResponse ( w , toAPIErrorCode ( err ) , r . URL )
writeErrorResponse ( w , toAPIErrorCode ( ctx , err ) , r . URL )
}
return
}
@ -2088,7 +2088,7 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
if err := deleteObject ( ctx , objectAPI , api . CacheAPI ( ) , bucket , object , r ) ; err != nil {
switch toAPIErrorCode ( err ) {
switch toAPIErrorCode ( ctx , err ) {
case ErrNoSuchBucket :
// When bucket doesn't exist specially handle it.
writeErrorResponse ( w , ErrNoSuchBucket , r . URL )