image/tree: Fix dangling filter condition

The logic for applying the dangling filter when `--all` is not used was
inverted. The filter was being applied when the dangling filter was
present, but it should be applied when the dangling filter is NOT
present.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-10-31 14:57:29 +01:00
parent 513ee76bac
commit 9e7937746c

View File

@ -116,7 +116,7 @@ func runImages(ctx context.Context, dockerCLI command.Cli, options imagesOptions
}
images := res.Items
if !options.all {
if _, ok := filters["dangling"]; ok {
if _, ok := filters["dangling"]; !ok {
images = slices.DeleteFunc(images, isDangling)
}
}