Return BadRequest for invalid large patch

This commit is contained in:
Jordan Liggitt 2021-11-21 09:13:37 -05:00
parent ed07515ee0
commit 2d307f47bd

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