DOCK-2477: Accept pairs of internal hyphens/underscores in entry names #5858
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.
Description
This PR changes the webservice to allow two consecutive internal hyphens/underscores in Entry names. Runs of three or more hyphens or underscores are still rejected, because we probably don't want entry names like
foo___________bar
.Whilst changing the responsible regular expression, I converted all of the quantifiers to be possessive, because there's no need for backtracking during matching. https://docs.oracle.com/javase/tutorial/essential/regex/quant.html
This will slightly improve performance and reduce the chance that the regexp could be used for a DOS attack.
The message that describes the requirements for an entry name (
ENTRY_NAME_REGEX_MESSAGE
) covers both the old and new criteria, so it doesn't need to change.Review Instructions
Register a valid entry with a name that contains two consecutive internal hyphens/underscores, and confirm the entry was successfully registered.
Issue
https://ucsc-cgl.atlassian.net/browse/DOCK-2477
#5715
Security and Privacy
No concerns.
e.g. Does this change...
Please make sure that you've checked the following before submitting your pull request. Thanks!
mvn clean install
@RolesAllowed
annotation