c8d/list: Skip images with non matching platform

Currently this won't have any real effect because the platform matcher
matches all platform and is only used for sorting.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2024-03-07 16:22:32 +01:00
parent 72f1f82f28
commit 2f1a32e3e5
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -262,6 +262,14 @@ func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platf
platform = dockerImage.Platform
}
// Filter out platforms that don't match the requested platform. Do it
// after the size, container count and chainIDs are summed up to have
// the single combined entry still represent the whole multi-platform
// image.
if !platformMatcher.Match(platform) {
return nil
}
if best == nil || platformMatcher.Less(platform, bestPlatform) {
best = img
bestPlatform = platform