mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-01 00:00:03 +08:00
Merge pull request #63059 from ceshihao/upgrade_json_package_fix_base64_newline
Automatic merge from submit-queue (batch tested with PRs 59965, 59115, 63076, 63059). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Upgrade dep json-iterator/go to fix base64 decode bug **What this PR does / why we need it**: upgrade dep `json-iterator/go` to fix base64 decode bug #62742 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #62742 **Special notes for your reviewer**: Just upgrade `json-iterator/go` to latest which includes base64 decode fix https://github.com/json-iterator/go/pull/266 No other code changes **Release note**: ```release-note None ``` Kubernetes-commit: 3dbcd1ddcee786f443f89a82514bbd9c6ad06c99
This commit is contained in:
+20
@@ -58,6 +58,26 @@ func (obj *Unstructured) IsList() bool {
|
||||
_, ok = field.([]interface{})
|
||||
return ok
|
||||
}
|
||||
func (obj *Unstructured) ToList() (*UnstructuredList, error) {
|
||||
if !obj.IsList() {
|
||||
// return an empty list back
|
||||
return &UnstructuredList{Object: obj.Object}, nil
|
||||
}
|
||||
|
||||
ret := &UnstructuredList{}
|
||||
ret.Object = obj.Object
|
||||
|
||||
err := obj.EachListItem(func(item runtime.Object) error {
|
||||
castItem := item.(*Unstructured)
|
||||
ret.Items = append(ret.Items, *castItem)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (obj *Unstructured) EachListItem(fn func(runtime.Object) error) error {
|
||||
field, ok := obj.Object["items"]
|
||||
|
||||
Reference in New Issue
Block a user