mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #39886 from liggitt/fix-empty-list-error
Automatic merge from submit-queue Only set empty list for list types If List() impls return non-list objects (like Status objects), we shouldn't try to set them to an empty list follow up to #39834
This commit is contained in:
commit
20d239a5bc
@ -335,7 +335,7 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch
|
||||
}
|
||||
trace.Step("Self-linking done")
|
||||
// Ensure empty lists return a non-nil items slice
|
||||
if numberOfItems == 0 {
|
||||
if numberOfItems == 0 && meta.IsListType(result) {
|
||||
if err := meta.SetList(result, []runtime.Object{}); err != nil {
|
||||
scope.err(err, res.ResponseWriter, req.Request)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user