mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
json unmarshal coded error at function applyJSPatch()
This commit is contained in:
parent
73b2c82b28
commit
1da2d00935
@ -341,7 +341,7 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, retErr
|
|||||||
// TODO(liggitt): drop this once golang json parser limits stack depth (https://github.com/golang/go/issues/31789)
|
// TODO(liggitt): drop this once golang json parser limits stack depth (https://github.com/golang/go/issues/31789)
|
||||||
if len(p.patchBytes) > 1024*1024 {
|
if len(p.patchBytes) > 1024*1024 {
|
||||||
v := []interface{}{}
|
v := []interface{}{}
|
||||||
if err := json.Unmarshal(p.patchBytes, v); err != nil {
|
if err := json.Unmarshal(p.patchBytes, &v); err != nil {
|
||||||
return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err))
|
return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ func (p *jsonPatcher) applyJSPatch(versionedJS []byte) (patchedJS []byte, retErr
|
|||||||
// TODO(liggitt): drop this once golang json parser limits stack depth (https://github.com/golang/go/issues/31789)
|
// TODO(liggitt): drop this once golang json parser limits stack depth (https://github.com/golang/go/issues/31789)
|
||||||
if len(p.patchBytes) > 1024*1024 {
|
if len(p.patchBytes) > 1024*1024 {
|
||||||
v := map[string]interface{}{}
|
v := map[string]interface{}{}
|
||||||
if err := json.Unmarshal(p.patchBytes, v); err != nil {
|
if err := json.Unmarshal(p.patchBytes, &v); err != nil {
|
||||||
return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err))
|
return nil, errors.NewBadRequest(fmt.Sprintf("error decoding patch: %v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user