-
Notifications
You must be signed in to change notification settings - Fork 63
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
Prevent duplicate and invalid titles #6326
base: master
Are you sure you want to change the base?
Conversation
e8c63dd
to
f23289c
Compare
@@ -367,7 +367,7 @@ public enum ParameterCore implements ParameterInterface { | |||
/** | |||
* Validation of process title via regular expression. | |||
*/ | |||
VALIDATE_PROCESS_TITLE_REGEX(new Parameter<>("validateProzessTitelRegex", "[\\w-]*")), | |||
VALIDATE_PROCESS_TITLE_REGEX(new Parameter<>("validateProzessTitelRegex", "^[a-zA-Z0-9_-]+$")), |
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.
Should the new default value not even updated in the kitodo_config.properties
files?
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 am wondering: This is a hard limitation of the Kitodo software, some titles lead to problems later. Should we allow to change that in the config.properties at all? Or should we hardcode that in the application? Additionally one can think of allowing additional regexes which might be checked on top of the minimal requirements. See #6055
cc @solth
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.
At SLUB we allow even the .
inside the process title as for historical reasons this was needed to create the processes. Maybe this can be changed now but this should be discussed.
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.
One more note: the w
meta character in regular expressions stands for a-z, A-Z, 0-9, including _ (underscore)
. So the expression can be simplified to ^[\\w-]+$
?
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.
What about chosing a new parameter name "validateProcessTitle" which avoids the current "denglisch" (English-German mix)?
Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java
Outdated
Show resolved
Hide resolved
f23289c
to
6037595
Compare
} | ||
|
||
@Test | ||
public void shouldNotAllowDuplicateTitles() throws Exception { |
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.
We probably have to take into account the configuration here. On some systems this is allowed...
Fixes
#6303
#6055