Updated query and user-group name pattern.
Change-Id: Ia18a1b9cc3c90a162108369aba37df7518e455da
diff --git a/full/Changes b/full/Changes
index c4b52fa..a354503 100644
--- a/full/Changes
+++ b/full/Changes
@@ -1,5 +1,7 @@
# version 0.66
+ - Updated query and user-group name pattern.
+
# version 0.65.2
2022-03-03
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index 750dba4..c3081ee 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -69,7 +69,8 @@
public static boolean DEBUG = false;
- public static Pattern queryNamePattern = Pattern.compile("[-\\w.]+");
+ public static Pattern queryNamePattern = Pattern
+ .compile("[a-zA-Z0-9]+[a-zA-Z_0-9-.]+");
@Autowired
private QueryDao queryDao;
@@ -319,8 +320,9 @@
if (!queryNamePattern.matcher(queryName).matches()) {
throw new KustvaktException(StatusCodes.INVALID_ARGUMENT, queryType
- .displayName() + " name must only contain "
- + "letters, numbers, underscores, hypens and spaces",
+ .displayName() + " must consists of alphanumerical characters "
+ + "(limited to ASCII), underscores, dashes and periods. "
+ + "The name has to start with an alphanumerical character.",
queryName);
}
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
index 6af321e..47d2c0c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -49,7 +49,8 @@
public static Logger jlog = LogManager.getLogger(UserGroupService.class);
public static boolean DEBUG = false;
- public static Pattern groupNamePattern = Pattern.compile("[-\\w.]+");
+ public static Pattern groupNamePattern = Pattern
+ .compile("[a-zA-Z0-9]+[a-zA-Z_0-9-.]+");
@Autowired
private UserGroupDao userGroupDao;
@@ -219,8 +220,9 @@
if (!groupNamePattern.matcher(groupName).matches()) {
throw new KustvaktException(StatusCodes.INVALID_ARGUMENT,
- "User-group name must only contains letters, numbers, "
- + "underscores, hypens and spaces",
+ "User-group name must consists of alphanumerical characters "
+ + "(limited to ASCII), underscores, dashes and periods. "
+ + "The name has to start with an alphanumerical character.",
groupName);
}