Skip to content
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

Fix component name validation regex #16

Closed
Skarlso opened this issue Jul 21, 2022 · 1 comment
Closed

Fix component name validation regex #16

Skarlso opened this issue Jul 21, 2022 · 1 comment
Assignees
Labels

Comments

@Skarlso
Copy link
Contributor

Skarlso commented Jul 21, 2022

When creating a component, the name validation regex is not strict enough. It needs to validate that the component name is valid in regards to being a DNS and also the fact that it should have a /name and the name is mandatory. For this, regex needs to be adjusted to be more strict, but also keep in mind that trailing // should not be allowed.

ocm create componentarchive test 0.0.1 skarlso test-validation
Error: invalid component info: component.name: Does not match pattern '^[a-z0-9.\-]+[.][a-z]{2,4}/[-a-z0-9/_.]*$'

^[a-z0-9.\-]+[.][a-z]{2,4}/[-a-z0-9/_.]*$

a.c/name - name is required
a.c/ - invalid
a.c/// - also invalid
a.c.c/adf/asdf - valid
a.c/asdf/<non-alphanumeric> - invalid
a.c/asdf/ - invalid ( trailing / )

@Skarlso
Copy link
Contributor Author

Skarlso commented Jul 25, 2022

Fixed in #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants