Skip to content

Commit 2bb753c

Browse files
committed
Don't allow underscores in TLD ROID suffixes
Per ICANN it's a disallowed character.
1 parent 0519e2f commit 2bb753c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/src/main/java/google/registry/model/tld/Tld.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ public Builder setEapFeeSchedule(ImmutableSortedMap<DateTime, Money> eapFeeSched
10341034
return this;
10351035
}
10361036

1037-
public static final Pattern ROID_SUFFIX_PATTERN = Pattern.compile("^[A-Z\\d_]{1,8}$");
1037+
public static final Pattern ROID_SUFFIX_PATTERN = Pattern.compile("^[A-Z\\d]{1,8}$");
10381038

10391039
public Builder setRoidSuffix(String roidSuffix) {
10401040
checkArgument(

core/src/test/java/google/registry/model/tld/TldTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ void testFailure_roidSuffixTooLong() {
751751
assertThrows(
752752
IllegalArgumentException.class,
753753
() -> Tld.get("tld").asBuilder().setRoidSuffix("123456789"));
754-
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z\\d_]{1,8}$");
754+
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z\\d]{1,8}$");
755755
}
756756

757757
@Test
@@ -766,6 +766,12 @@ void testFailure_roidSuffixContainsInvalidCharacters() {
766766
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("ABC-DEF"));
767767
}
768768

769+
@Test
770+
void testFailure_roidSuffixContainsUnderscores() {
771+
assertThrows(
772+
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("ABC_DEF"));
773+
}
774+
769775
@Test
770776
void testSuccess_setDefaultPromoTokens() {
771777
Tld registry = Tld.get("tld");

0 commit comments

Comments
 (0)