update c/{common,image,storage} to latest

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-06-13 16:27:51 +02:00
parent 2a947c2f4b
commit 8c48f97c90
38 changed files with 463 additions and 231 deletions

View File

@@ -3,7 +3,8 @@ package types
import (
"errors"
"fmt"
"regexp"
"github.com/containers/storage/pkg/regexp"
)
var (
@@ -19,7 +20,11 @@ var (
// NameRegex is a regular expression to validate names.
// This must NOT be changed.
NameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
NameRegex = regexp.Delayed("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
// RegexError is thrown in presence of an invalid name.
RegexError = fmt.Errorf("names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: %w", ErrInvalidArg) // nolint:revive // This lint is new and we do not want to break the API.
// NotHexRegex is a regular expression to check if a string is
// a hexadecimal string.
NotHexRegex = regexp.Delayed(`[^0-9a-fA-F]`)
)

View File

@@ -38,7 +38,7 @@ func createFilterFuncs(key string, filterValues []string) (types.FilterFunc, err
case "id":
// matches part of one id
return func(net types.Network) bool {
return util.StringMatchRegexSlice(net.ID, filterValues)
return util.FilterID(net.ID, filterValues)
}, nil
// TODO: add dns enabled, internal filter