Return BadRequest for invalid large patch

Kubernetes-commit: 2d307f47bd43902ee8f15751130dcbf4a4f775bf
This commit is contained in:
Jordan Liggitt 2021-11-21 09:13:37 -05:00 committed by Kubernetes Publisher
parent 4f539826fa
commit f0c214506c
1 changed files with 3 additions and 0 deletions

View File

@ -412,6 +412,9 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, strict
}
patchedJS, retErr = jsonpatch.MergePatch(versionedJS, p.patchBytes)
if retErr == jsonpatch.ErrBadJSONPatch {
return nil, nil, errors.NewBadRequest(retErr.Error())
}
return patchedJS, strictErrors, retErr
default:
// only here as a safety net - go-restful filters content-type