Use common identifiers package with less restrictive regex
Regular expressions in the namespaces package are redundant with the pre-existing validator in the "identifiers" package; replace this custom usage with the validator in "identifiers" Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/identifiers"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -70,7 +71,7 @@ func NamespaceRequired(ctx context.Context) (string, error) {
|
||||
if !ok || namespace == "" {
|
||||
return "", errors.Wrapf(errdefs.ErrFailedPrecondition, "namespace is required")
|
||||
}
|
||||
if err := Validate(namespace); err != nil {
|
||||
if err := identifiers.Validate(namespace); err != nil {
|
||||
return "", errors.Wrap(err, "namespace validation")
|
||||
}
|
||||
return namespace, nil
|
||||
|
||||
Reference in New Issue
Block a user