mirror of
https://github.com/containers/podman.git
synced 2025-10-18 11:42:55 +08:00
Do not crash on invalid filters
Vendor in latest containers/common Fixes #23120 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
6
vendor/github.com/containers/common/libimage/filters.go
generated
vendored
6
vendor/github.com/containers/common/libimage/filters.go
generated
vendored
@ -88,6 +88,8 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
|
||||
return tree, nil
|
||||
}
|
||||
|
||||
filterInvalidValue := `invalid image filter %q: must be in the format "filter=value or filter!=value"`
|
||||
|
||||
var wantedReferenceMatches, unwantedReferenceMatches []string
|
||||
filters := map[string][]filterFunc{}
|
||||
duplicate := map[string]string{}
|
||||
@ -101,7 +103,7 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
|
||||
} else {
|
||||
split = strings.SplitN(f, "=", 2)
|
||||
if len(split) != 2 {
|
||||
return nil, fmt.Errorf("invalid image filter %q: must be in the format %q", f, "filter=value or filter!=value")
|
||||
return nil, fmt.Errorf(filterInvalidValue, f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +197,7 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
|
||||
filter = filterBefore(until)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported image filter %q", key)
|
||||
return nil, fmt.Errorf(filterInvalidValue, key)
|
||||
}
|
||||
if negate {
|
||||
filter = negateFilter(filter)
|
||||
|
Reference in New Issue
Block a user