Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@monitorjbl
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

leocwolter added a commit that referenced this pull request Oct 9, 2014
Regex validation for tag names
@leocwolter leocwolter merged commit 153dfaf into caelum:master Oct 9, 2014
@leocwolter leocwolter mentioned this pull request Nov 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tag titles should not contain separator characters

2 participants