diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index 3a185aafe..d42158571 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -31,6 +31,7 @@ import ( "sort" "strconv" + etcd "github.com/coreos/etcd/client" "github.com/gorilla/mux" miniogo "github.com/minio/minio-go" "github.com/minio/minio/cmd/logger" @@ -1539,6 +1540,27 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http. return } + if globalDNSConfig != nil { + _, err := globalDNSConfig.Get(bucket) + if err != nil { + if etcd.IsKeyNotFound(err) || err == dns.ErrNoEntriesFound { + writeErrorResponse(w, ErrNoSuchBucket, r.URL) + } else { + writeErrorResponse(w, toAPIErrorCode(err), r.URL) + } + return + } + } else { + getBucketInfo := objectAPI.GetBucketInfo + if api.CacheAPI() != nil { + getBucketInfo = api.CacheAPI().GetBucketInfo + } + if _, err := getBucketInfo(ctx, bucket); err != nil { + writeErrorResponse(w, toAPIErrorCode(err), r.URL) + return + } + } + // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html // Ignore delete object errors while replying to client, since we are // suppposed to reply only 204. Additionally log the error for