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

Add version label check for valid characters #711

Closed
wants to merge 2 commits into from

Conversation

osmandin
Copy link
Contributor

* @param label label
* @return whether label contains valid characters
*/
public boolean invalidLabel(final String label) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be "private".
Also, I agree with the javadocs on this method, that it is more clear if the method returns whether the arg label is valid. Additionally, it would make the logic above easier to read, i.e. no double-negative. Instead it would read:
if (!isBlank(slug) && validLabel(slug)) {

I suggest renaming the method and returning !matcher.find()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In looking at this closer, the label validation should be enforced even if the user does not make the request via the REST API. Therefore, you should move your updates deeper into the application, i.e. https://github.com/fcrepo4/fcrepo4/blob/master/fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/VersionServiceImpl.java#L162

@awoods
Copy link

awoods commented Feb 19, 2015

Resolved with: bb6072d

@awoods awoods closed this Feb 19, 2015
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.

None yet

2 participants