@ -891,9 +891,15 @@ func (api objectAPIHandlers) DeleteBucketHandler(w http.ResponseWriter, r *http.
vars := mux . Vars ( r )
vars := mux . Vars ( r )
bucket := vars [ "bucket" ]
bucket := vars [ "bucket" ]
objectAPI := api . ObjectAPI ( )
if objectAPI == nil {
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( ErrServerNotInitialized ) , r . URL , guessIsBrowserReq ( r ) )
return
}
forceDelete := false
forceDelete := false
if vs , found := r . Header [ http . CanonicalHeaderKey ( "x-minio-force-delete" ) ] ; found {
if value := r . Header . Get ( xhttp . MinIOForceDelete ) ; value != "" {
switch strings . ToLower ( strings . Join ( vs , "" ) ) {
switch value {
case "true" :
case "true" :
forceDelete = true
forceDelete = true
case "false" :
case "false" :
@ -903,16 +909,22 @@ func (api objectAPIHandlers) DeleteBucketHandler(w http.ResponseWriter, r *http.
}
}
}
}
objectAPI := api . ObjectAPI ( )
if forceDelete {
if objectAPI == nil {
if s3Error := checkRequestAuthType ( ctx , r , policy . ForceDeleteBucketAction , bucket , "" ) ; s3Error != ErrNone {
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( ErrServerNotInitialized ) , r . URL , guessIsBrowserReq ( r ) )
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( s3Error ) , r . URL , guessIsBrowserReq ( r ) )
return
return
}
}
} else {
if s3Error := checkRequestAuthType ( ctx , r , policy . DeleteBucketAction , bucket , "" ) ; s3Error != ErrNone {
if s3Error := checkRequestAuthType ( ctx , r , policy . DeleteBucketAction , bucket , "" ) ; s3Error != ErrNone {
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( s3Error ) , r . URL , guessIsBrowserReq ( r ) )
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( s3Error ) , r . URL , guessIsBrowserReq ( r ) )
return
return
}
}
}
if _ , ok := globalBucketObjectLockConfig . Get ( bucket ) ; ( ok || globalWORMEnabled ) && forceDelete {
writeErrorResponse ( ctx , w , errorCodes . ToAPIErr ( ErrMethodNotAllowed ) , r . URL , guessIsBrowserReq ( r ) )
return
}
deleteBucket := objectAPI . DeleteBucket
deleteBucket := objectAPI . DeleteBucket