Skip to content

Commit

Permalink
Edited validation regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
lfabriko authored and avano committed Jan 16, 2023
1 parent 17216bb commit 1852603
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class KnativeValidation {
private static final Logger LOG = LoggerFactory.getLogger(KnativeValidation.class);
// This string is from the error message when you try to create a resource with invalid name
private static final String NAME_VALIDATION_REGEX = "[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*";
private static final String NAME_VALIDATION_REGEX = "[a-z]([-a-z0-9]*[a-z0-9])?";

private final KnativeClient client;

Expand Down Expand Up @@ -81,8 +81,8 @@ public String getRouteUrl(String serviceName) {

private void validateName(String name) {
if (!name.matches(NAME_VALIDATION_REGEX)) {
throw new IllegalArgumentException("Name must consist of lower case alphanumeric characters, '-' or '.',"
+ " and must start and end with an alphanumeric character (was: " + name + ")");
throw new IllegalArgumentException("Name must consist of lower case alphanumeric characters, '-'"
+ " and must start and end with an alphabetic character (was: " + name + ")");
}
}
}

0 comments on commit 1852603

Please sign in to comment.