Merge pull request #45345 from thaJeztah/no_version_loop

api/server: getImagesJSON(): don't check version in a loop
This commit is contained in:
Sebastiaan van Stijn 2023-04-17 14:37:36 +02:00 committed by GitHub
commit ad2ab4927c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -356,8 +356,9 @@ func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter,
return err
}
useNone := versions.LessThan(version, "1.43")
for _, img := range images {
if versions.LessThan(version, "1.43") {
if useNone {
if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 {
img.RepoTags = append(img.RepoTags, "<none>:<none>")
img.RepoDigests = append(img.RepoDigests, "<none>@<none>")