diff --git a/SingularityService/src/main/java/com/hubspot/singularity/data/SingularityValidator.java b/SingularityService/src/main/java/com/hubspot/singularity/data/SingularityValidator.java index dfc0152ec0..3a6a509392 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/data/SingularityValidator.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/data/SingularityValidator.java @@ -74,7 +74,7 @@ @Singleton public class SingularityValidator { private static final Joiner JOINER = Joiner.on(" "); - private static final Pattern DEPLOY_ID_ILLEGAL_PATTERN = Pattern.compile("[^a-zA-Z0-9_]"); + private static final Pattern DEPLOY_ID_ILLEGAL_PATTERN = Pattern.compile("[^a-zA-Z0-9_.]"); private static final Pattern REQUEST_ID_ILLEGAL_PATTERN = Pattern.compile("[^a-zA-Z0-9_-]"); private static final Pattern DAY_RANGE_REGEXP = Pattern.compile("[0-7]-[0-7]"); private static final Pattern COMMA_DAYS_REGEXP = Pattern.compile("([0-7],)+([0-7])?"); @@ -274,7 +274,7 @@ public SingularityDeploy checkDeploy(SingularityRequest request, deployId = deploy.getId(); } - checkBadRequest(deployId != null && ! DEPLOY_ID_ILLEGAL_PATTERN.matcher(deployId).find(), "Id cannot be null or contain characters other than [a-zA-Z0-9_]"); + checkBadRequest(deployId != null && ! DEPLOY_ID_ILLEGAL_PATTERN.matcher(deployId).find(), "Id cannot be null or contain characters other than [a-zA-Z0-9_.]"); checkBadRequest(deployId.length() <= maxDeployIdSize, "Deploy id must be %s characters or less, it is %s (%s)", maxDeployIdSize, deployId.length(), deployId); checkBadRequest(deploy.getRequestId() != null && deploy.getRequestId().equals(request.getId()), "Deploy id must match request id"); diff --git a/SingularityService/src/test/java/com/hubspot/singularity/data/ValidatorTest.java b/SingularityService/src/test/java/com/hubspot/singularity/data/ValidatorTest.java index dc5c5159ba..bf153d90ce 100644 --- a/SingularityService/src/test/java/com/hubspot/singularity/data/ValidatorTest.java +++ b/SingularityService/src/test/java/com/hubspot/singularity/data/ValidatorTest.java @@ -88,7 +88,7 @@ public void itForbidsQuotesInDeployIds() throws Exception { WebApplicationException exn = (WebApplicationException) catchThrowable(() -> validator.checkDeploy(singularityRequest, singularityDeploy, Collections.emptyList(), Collections.emptyList())); assertThat((String) exn.getResponse().getEntity()) - .contains("[a-zA-Z0-9_]"); + .contains("[a-zA-Z0-9_.]"); } @Test(expected = WebApplicationException.class)