-
Couldn't load subscription status.
- Fork 151
Regex validation for tag names #93
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
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.
This is kind of hokey, but I don't know of a better way to control this flow. The problem is that without this if-then-return bit, the second step of the validation puts an additional message in that reads The tag "{0}" doesn't exist, which looks bad.
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 could just put the validation at the TagValidator. If there are any validation errors, the transaction will not be commited, you don't have to worry about saving an invalid tag.
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.
Let me give that a shot, I'd like that a lot better if it works.
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.
Nice, that worked! Much cleaner.
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 guess we should only verify if name matches that regex, right?
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.
Oh sorry, I thought the regex was meant to match not allowed characters. It makes sense that way
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.
In my experience, getting regex to do a reverse match is a pain. I figured it'd be easier this way. I can try switching it around though, if you'd prefer it that way.
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, its perfect as it is, thanks :D
Regex validation for tag names
Closes #91. Introduces a config option to specify a regex for allowed tag names. If any characters not matching this regex are found, then a validation error will be thrown with the details of the problem.