validate bucket exists in ListRemoteTargets api (#10552)

This commit is contained in:
poornas 2020-09-23 10:37:54 -07:00 committed by GitHub
parent 5fdf47b118
commit 5726cef3ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,6 +226,11 @@ func (a adminAPIHandlers) ListRemoteTargetsHandler(w http.ResponseWriter, r *htt
return
}
if bucket != "" {
// Check if bucket exists.
if _, err := objectAPI.GetBucketInfo(ctx, bucket); err != nil {
writeErrorResponseJSON(ctx, w, toAPIError(ctx, err), r.URL)
return
}
if _, err := globalBucketMetadataSys.GetBucketTargetsConfig(bucket); err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return