From b3e0e1a33d072b542707005f9f6da66d8de2a021 Mon Sep 17 00:00:00 2001 From: LingFaKe Date: Fri, 28 Oct 2016 18:51:24 +0800 Subject: [PATCH] Add regular expression for object names in 'refs' 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 --- specs-go/v1/layout.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/specs-go/v1/layout.go b/specs-go/v1/layout.go index a54a461c5..c44486bfb 100644 --- a/specs-go/v1/layout.go +++ b/specs-go/v1/layout.go @@ -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-._]+$`) +)