Skip to content

Commit

Permalink
Add regular expression for object names in 'refs'
Browse files Browse the repository at this point in the history
it will be used in 'image-tools' or other project for checking regular
expression of 'refs', which writes as "Object names in the refs
subdirectories MUST NOT include characters outside of the set of "A" to
"Z", "a" to "z", "0" to "9", the hyphen -, the dot ., and the underscore
_." at https://github.com/opencontainers/image-spec/blob/master/image-layout.md

Signed-off-by: Ling FaKe <lingfake@huawei.com>
  • Loading branch information
LingFaKe committed Oct 29, 2016
1 parent 7a6820e commit b3e0e1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions specs-go/v1/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@

package v1

import "regexp"

// ImageLayout is the structure in the "oci-layout" file, found in the root
// of an OCI Image-layout directory.
type ImageLayout struct {
Version string `json:"imageLayoutVersion"`
}

var (
// RefsRegexp matches requirement of image-layout 'refs' charset.
RefsRegexp = regexp.MustCompile(`^[a-zA-Z0-9-._]+$`)
)

0 comments on commit b3e0e1a

Please sign in to comment.