-
Notifications
You must be signed in to change notification settings - Fork 775
Add regular expression for object names in 'refs' #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
specs-go/v1/image_layout.go
Outdated
| var ( | ||
| // refRegexp for string ref should be complied with description "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. | ||
| RefsRegexp = regexp.MustCompile(`^[a-zA-Z0-9\-\.\_]+?$`) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shift to specs-go/v1/layout.go, which already has some image-layout stuff (and may get more soon, #414)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
|
@wking it is done, PTAL. |
specs-go/v1/layout.go
Outdated
| } | ||
|
|
||
| var ( | ||
| // RefsRegexp for string ref should be complied with description "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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the URL anymore now that we're in the same repository. How about:
// RefsRegexp matches refs that meet the image-layout charset requirements.
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will simplify the comment phrase.
specs-go/v1/layout.go
Outdated
|
|
||
| var ( | ||
| // RefsRegexp for string ref should be complied with description "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. | ||
| RefsRegexp = regexp.MustCompile(`^[a-zA-Z0-9\-\.\_]+?$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to backslash-escape hyphen, period, or underscore inside your brackets. And I'm not sure why you have the ?. So I think this should be something like:
RefsRegexp = regexp.MustCompile(`^[a-zA-Z0-9-._]+$`)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you.
|
Cross-referencing opencontainers/image-tools#61. |
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]>
|
@wking updated it, PTAL. |
|
b3e0e1a looks good to me.
|
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]