Fixed code which generated groups id from name

This commit is contained in:
Luca Frosini 2022-04-27 16:19:48 +02:00
parent 1103c11626
commit 312f3945a5
2 changed files with 7 additions and 6 deletions

View File

@ -6,9 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v1.13.1-SNAPSHOT] ## [v1.13.1-SNAPSHOT]
- Aligned code and wiki to the new requirements [#23167] - Aligned code and wiki to the new requirements [#23167]
- Changed group assign strategy #23215 - Changed group assign strategy [#23211] [#23215]
- Tag are added also to legacy records - Tag are added also to legacy records [#23216]
- Fixed code which generated groups id from name [#23215]
## [v1.13.0] ## [v1.13.0]

View File

@ -87,12 +87,13 @@ public abstract class HelperMethods {
*/ */
public static String getGroupNameOnCkan(String origName){ public static String getGroupNameOnCkan(String origName){
if(origName == null) if(origName == null) {
throw new IllegalArgumentException("origName cannot be null"); throw new IllegalArgumentException("origName cannot be null");
}
String modified = origName.replaceAll("\\(", ""); String modified = origName.replaceAll("\\(", "");
modified = origName.replaceAll("\\)", ""); modified = modified.replaceAll("\\)", "");
modified = origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-"); modified = modified.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-");
if(modified.startsWith("-")) if(modified.startsWith("-"))
modified = modified.substring(1); modified = modified.substring(1);
if(modified.endsWith("-")) if(modified.endsWith("-"))