mirror of
https://github.com/distribution/distribution
synced 2024-09-07 11:26:51 +00:00
Merge pull request #212 from stevvooe/add-documentation-name-validator
documentation for name validation grammar
This commit is contained in:
commit
72b48812b4
1 changed files with 10 additions and 0 deletions
|
@ -82,6 +82,16 @@ var (
|
|||
// registry. This function accepts a superset of what might be accepted by
|
||||
// docker core or docker hub. If the name does not pass validation, an error,
|
||||
// describing the conditions, is returned.
|
||||
//
|
||||
// Effectively, the name should comply with the following grammar:
|
||||
//
|
||||
// alpha-numeric := /[a-z0-9]+/
|
||||
// separator := /[._-]/
|
||||
// component := alpha-numeric [separator alpha-numeric]*
|
||||
// namespace := component ['/' component]*
|
||||
//
|
||||
// The result of the production, known as the "namespace", should be limited
|
||||
// to 255 characters.
|
||||
func ValidateRespositoryName(name string) error {
|
||||
if len(name) > RepositoryNameTotalLengthMax {
|
||||
return ErrRepositoryNameLong
|
||||
|
|
Loading…
Reference in a new issue