mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Return title fields as a list
Podman is attempting to split the headers returned by the ps command into a list of headers. Problem is that some headers are multi-word, and headers are not guaranteed to be split via a tab. This PR splits the headers bases on white space, and for the select group of CAPS headers which are multi-word, combines them back together. Fixes: https://github.com/containers/podman/issues/17524 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -63,7 +63,7 @@ loop: // break out of for/select infinite` loop
|
||||
case <-r.Context().Done():
|
||||
break loop
|
||||
default:
|
||||
output, err := c.Top([]string{query.PsArgs})
|
||||
output, err := c.Top(strings.Split(query.PsArgs, ","))
|
||||
if err != nil {
|
||||
logrus.Infof("Error from %s %q : %v", r.Method, r.URL, err)
|
||||
break loop
|
||||
@ -71,7 +71,8 @@ loop: // break out of for/select infinite` loop
|
||||
|
||||
if len(output) > 0 {
|
||||
body := handlers.ContainerTopOKBody{}
|
||||
body.Titles = strings.Split(output[0], "\t")
|
||||
body.Titles = utils.PSTitles(output[0])
|
||||
|
||||
for i := range body.Titles {
|
||||
body.Titles[i] = strings.TrimSpace(body.Titles[i])
|
||||
}
|
||||
|
Reference in New Issue
Block a user