diff options
| author | Paweł Gronowski <pawel.gronowski@docker.com> | 2023-02-23 15:40:26 +0100 |
|---|---|---|
| committer | Paweł Gronowski <pawel.gronowski@docker.com> | 2023-02-27 19:44:43 +0100 |
| commit | 248745004a81dcb32458c8b1b83333f2e1683edc (patch) | |
| tree | 9d5afb4ca7d418233355bca67cedec9cfbddfb18 /api/server | |
| parent | 0021339b9299c5f1596bdf772a42ce346f16f060 (diff) | |
| download | docker-248745004a81dcb32458c8b1b83333f2e1683edc.tar.gz | |
api: Remove <none> in Repo(Tags|Digests) for >= 1.43
Deprecate `<none>:<none>` and `<none>@<none>` magic strings included in
`RepoTags` and `RepoDigests`.
Produce an empty arrays instead and leave the presentation of
untagged/dangling images up to the client.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Diffstat (limited to 'api/server')
| -rw-r--r-- | api/server/router/image/image_routes.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/api/server/router/image/image_routes.go b/api/server/router/image/image_routes.go index 3a4322371b..5e0cbac315 100644 --- a/api/server/router/image/image_routes.go +++ b/api/server/router/image/image_routes.go @@ -338,9 +338,18 @@ func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter, } for _, img := range images { - if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 { - img.RepoTags = append(img.RepoTags, "<none>:<none>") - img.RepoDigests = append(img.RepoDigests, "<none>@<none>") + if versions.LessThan(version, "1.43") { + if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 { + img.RepoTags = append(img.RepoTags, "<none>:<none>") + img.RepoDigests = append(img.RepoDigests, "<none>@<none>") + } + } else { + if img.RepoTags == nil { + img.RepoTags = []string{} + } + if img.RepoDigests == nil { + img.RepoDigests = []string{} + } } } |
