mirror of https://github.com/minio/minio.git
Add dummy DeleteBucketCors for safety (#20253)
This commit is contained in:
parent
04be352ae9
commit
37c02a5f7b
|
@ -460,6 +460,10 @@ func registerAPIRouter(router *mux.Router) {
|
||||||
router.Methods(http.MethodPut).
|
router.Methods(http.MethodPut).
|
||||||
HandlerFunc(s3APIMiddleware(api.PutBucketCorsHandler)).
|
HandlerFunc(s3APIMiddleware(api.PutBucketCorsHandler)).
|
||||||
Queries("cors", "")
|
Queries("cors", "")
|
||||||
|
// DeleteBucketCors - this is a dummy call.
|
||||||
|
router.Methods(http.MethodDelete).
|
||||||
|
HandlerFunc(s3APIMiddleware(api.DeleteBucketCorsHandler)).
|
||||||
|
Queries("cors", "")
|
||||||
// GetBucketWebsiteHandler - this is a dummy call.
|
// GetBucketWebsiteHandler - this is a dummy call.
|
||||||
router.Methods(http.MethodGet).
|
router.Methods(http.MethodGet).
|
||||||
HandlerFunc(s3APIMiddleware(api.GetBucketWebsiteHandler)).
|
HandlerFunc(s3APIMiddleware(api.GetBucketWebsiteHandler)).
|
||||||
|
|
|
@ -225,3 +225,33 @@ func (api objectAPIHandlers) PutBucketCorsHandler(w http.ResponseWriter, r *http
|
||||||
|
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteBucketCorsHandler - DELETE bucket cors, a dummy api
|
||||||
|
func (api objectAPIHandlers) DeleteBucketCorsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := newContext(r, w, "DeleteBucketCors")
|
||||||
|
|
||||||
|
defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
|
||||||
|
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
bucket := vars["bucket"]
|
||||||
|
|
||||||
|
objAPI := api.ObjectAPI()
|
||||||
|
if objAPI == nil {
|
||||||
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if s3Error := checkRequestAuthType(ctx, r, policy.DeleteBucketCorsAction, bucket, ""); s3Error != ErrNone {
|
||||||
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate if bucket exists, before proceeding further...
|
||||||
|
_, err := objAPI.GetBucketInfo(ctx, bucket, BucketOptions{})
|
||||||
|
if err != nil {
|
||||||
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue