Skip to content

Commit b3e0e1a

Browse files
author
LingFaKe
committed
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 <[email protected]>
1 parent 7a6820e commit b3e0e1a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

specs-go/v1/layout.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414

1515
package v1
1616

17+
import "regexp"
18+
1719
// ImageLayout is the structure in the "oci-layout" file, found in the root
1820
// of an OCI Image-layout directory.
1921
type ImageLayout struct {
2022
Version string `json:"imageLayoutVersion"`
2123
}
24+
25+
var (
26+
// RefsRegexp matches requirement of image-layout 'refs' charset.
27+
RefsRegexp = regexp.MustCompile(`^[a-zA-Z0-9-._]+$`)
28+
)

0 commit comments

Comments
 (0)