summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/system.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-07-19 22:55:27 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-07-19 22:55:27 +0200
commit67a5e21bf84f44be182fd2a5aace4a17be226a84 (patch)
tree744e15183f75794ebe436d461334154a666b8dc0 /pkg/domain/infra/abi/system.go
parentb7b8fce82693ae0f9ebb0561cd3e6c118ad35fe9 (diff)
downloadpodman-67a5e21bf84f44be182fd2a5aace4a17be226a84.tar.gz
podman-67a5e21bf84f44be182fd2a5aace4a17be226a84.tar.bz2
podman-67a5e21bf84f44be182fd2a5aace4a17be226a84.zip
fix: system df error when an image has no name
When an image has no name/tag system df will error because it tries to parse an empty name. This commit makes sure we only parse non empty names and set the repository and tag to "<none>" otherwise. Closes #7015 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/domain/infra/abi/system.go')
-rw-r--r--pkg/domain/infra/abi/system.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index bedd050ff..9727f1d4e 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -230,13 +230,18 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
}
}
- named, err := reference.ParseNormalizedNamed(name)
- if err != nil {
- return nil, err
- }
- repository = named.Name()
- if tagged, isTagged := named.(reference.NamedTagged); isTagged {
- tag = tagged.Tag()
+ if len(name) > 0 {
+ named, err := reference.ParseNormalizedNamed(name)
+ if err != nil {
+ return nil, err
+ }
+ repository = named.Name()
+ if tagged, isTagged := named.(reference.NamedTagged); isTagged {
+ tag = tagged.Tag()
+ }
+ } else {
+ repository = "<none>"
+ tag = "<none>"
}
report := entities.SystemDfImageReport{