Add regular expression for object names in 'refs'#421
Merged
jonboulle merged 1 commit intoopencontainers:masterfrom Nov 21, 2016
TrumanLing:RefsRegularExp
Merged
Add regular expression for object names in 'refs'#421jonboulle merged 1 commit intoopencontainers:masterfrom TrumanLing:RefsRegularExp
jonboulle merged 1 commit intoopencontainers:masterfrom
TrumanLing:RefsRegularExp
Conversation
wking
reviewed
Oct 28, 2016
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\-\.\_]+?$`) | ||
| ) |
Contributor
There was a problem hiding this comment.
Shift to specs-go/v1/layout.go, which already has some image-layout stuff (and may get more soon, #414)?
Author
|
@wking it is done, PTAL. |
wking
reviewed
Oct 28, 2016
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. |
Contributor
There was a problem hiding this comment.
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?
Author
There was a problem hiding this comment.
OK, I will simplify the comment phrase.
wking
reviewed
Oct 28, 2016
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\-\.\_]+?$`) |
Contributor
There was a problem hiding this comment.
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-._]+$`)
Contributor
|
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 <lingfake@huawei.com>
Author
|
@wking updated it, PTAL. |
Contributor
|
b3e0e1a looks good to me.
|
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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