@@ -10,14 +10,14 @@ type ErrInvalidID struct {
1010}
1111
1212func (e ErrInvalidID ) Error () string {
13- return fmt .Sprintf ("invalid identifier: %q must match [A-Za-z0-9.-]+(/[A-Za-z0-9.-]+)*? " , e .ID )
13+ return fmt .Sprintf ("invalid identifier: %q must match ^ [A-Za-z0-9._: -]+(?: /[A-Za-z0-9._: -]+)*$ " , e .ID )
1414}
1515
1616// validIdentifier checks if an identifier is valid without using regexp or unicode.
1717// Rules:
1818// - Components separated by '/'
1919// - Each component is non-empty
20- // - Only characters A-Z, a-z, 0-9, '.', '_' or '- '
20+ // - Only characters A-Z, a-z, 0-9, '.', '_', '-' or ': '
2121// - No leading, trailing, or double slashes
2222func validIdentifier (s string ) bool {
2323 if len (s ) == 0 {
@@ -49,7 +49,7 @@ func isValidRune(c rune) bool {
4949 return (c >= 'A' && c <= 'Z' ) ||
5050 (c >= 'a' && c <= 'z' ) ||
5151 (c >= '0' && c <= '9' ) ||
52- c == '.' || c == '-' || c == '_'
52+ c == '.' || c == '-' || c == '_' || c == ':'
5353}
5454
5555func split (s string ) []string {
@@ -108,7 +108,7 @@ func valid(id string) error {
108108}
109109
110110// ID contains a secret identifier.
111- // Valid secret identifiers must match the format [A-Za-z0-9.-]+(/[A-Za-z0-9.-]+)+? .
111+ // Valid secret identifiers must match the format ^ [A-Za-z0-9._: -]+(?: /[A-Za-z0-9._: -]+)*$ .
112112//
113113// For storage, we don't really differentiate much about the ID format but
114114// by convention we do simple, slash-separated management, providing a
@@ -142,7 +142,7 @@ func (i id) String() string {
142142// Rules:
143143// - Components separated by '/'
144144// - Each component is non-empty
145- // - Only characters A-Z, a-z, 0-9, '.', '_' or '- '
145+ // - Only characters A-Z, a-z, 0-9, '.', '_', '-' or ': '
146146// - No leading, trailing, or double slashes
147147func ParseID (s string ) (ID , error ) {
148148 if err := valid (s ); err != nil {
0 commit comments