validate image ID properly & before load
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> Conflicts: graph/load.go
This commit is contained in:
parent
6fa196282d
commit
fdd4f4f2d1
1 changed files with 2 additions and 2 deletions
|
@ -23,7 +23,6 @@ var (
|
||||||
ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")")
|
ErrInvalidRepositoryName = errors.New("Invalid repository name (ex: \"registry.domain.tld/myrepos\")")
|
||||||
ErrDoesNotExist = errors.New("Image does not exist")
|
ErrDoesNotExist = errors.New("Image does not exist")
|
||||||
errLoginRequired = errors.New("Authentication is required.")
|
errLoginRequired = errors.New("Authentication is required.")
|
||||||
validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
|
||||||
validNamespace = regexp.MustCompile(`^([a-z0-9_]{4,30})$`)
|
validNamespace = regexp.MustCompile(`^([a-z0-9_]{4,30})$`)
|
||||||
validRepo = regexp.MustCompile(`^([a-z0-9-_.]+)$`)
|
validRepo = regexp.MustCompile(`^([a-z0-9-_.]+)$`)
|
||||||
)
|
)
|
||||||
|
@ -171,7 +170,8 @@ func validateRepositoryName(repositoryName string) error {
|
||||||
namespace = "library"
|
namespace = "library"
|
||||||
name = nameParts[0]
|
name = nameParts[0]
|
||||||
|
|
||||||
if validHex.MatchString(name) {
|
// the repository name must not be a valid image ID
|
||||||
|
if err := utils.ValidateID(name); err == nil {
|
||||||
return fmt.Errorf("Invalid repository name (%s), cannot specify 64-byte hexadecimal strings", name)
|
return fmt.Errorf("Invalid repository name (%s), cannot specify 64-byte hexadecimal strings", name)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue