Merge pull request #45508 from laurazard/c8d-dangling-image-history

c8d: image history – handle dangling images
This commit is contained in:
Sebastiaan van Stijn 2023-05-10 22:30:02 +02:00 committed by GitHub
commit 3b443c8cfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,13 +90,16 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*imaget
return nil, err
}
tags := make([]string, len(tagged))
for i, t := range tagged {
var tags []string
for _, t := range tagged {
if isDanglingImage(t) {
continue
}
name, err := reference.ParseNamed(t.Name)
if err != nil {
return nil, err
}
tags[i] = reference.FamiliarString(name)
tags = append(tags, reference.FamiliarString(name))
}
history[0].Tags = tags
}