Skip to content

Commit

Permalink
improve invalid datasource name exception for LDEV-4787
Browse files Browse the repository at this point in the history
  • Loading branch information
cfmitrah committed Feb 2, 2024
1 parent bdcf402 commit 537638d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/tag/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2628,11 +2628,11 @@ private void doUpdateDatasource() throws PageException {
cn = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}

Pattern pattern = Pattern.compile("[a-zA-Z0-9_]*");
Pattern pattern = Pattern.compile("[a-zA-Z0-9_-]*");
Matcher matcher = pattern.matcher(getString("admin", action, "newName"));

if (matcher.matches() == false) {
throw new ExpressionException("Trying to create a data source with a name that is invalid. Data source Names must match proper variable naming conventions");
throw new ExpressionException("Creating a datasource name was invalid; valid formats include alphanumeric characters, underscores and hyphens");
}

ClassDefinition cd = new ClassDefinitionImpl(cn, getString("bundleName", null), getString("bundleVersion", null), config.getIdentification());
Expand Down

0 comments on commit 537638d

Please sign in to comment.