mirror of
https://github.com/google/nomulus.git
synced 2025-07-20 01:35:59 +02:00
Add validation to ROID suffixes
I could've sworn we were already doing this, but apparently not? Anyway, ROID suffixes have a number of requirements on them that weren't being enforced, so this enforces them. All existing production data is compliant with these requirements; the only existing bad data we have is in alpha and sandbox. ROID suffixes are now required to match the regex ^[A-Z0-9_]{1,8}$ See also https://tools.ietf.org/html/rfc5730 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173400001
This commit is contained in:
parent
2f539d6008
commit
7951799595
4 changed files with 39 additions and 8 deletions
|
@ -418,10 +418,11 @@ public class DatastoreHelper {
|
|||
}
|
||||
|
||||
public static void createTld(String tld, ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
createTld(
|
||||
tld,
|
||||
Ascii.toUpperCase(tld.replaceFirst(ACE_PREFIX_REGEX, "").replace('.', '_')),
|
||||
tldStates);
|
||||
// Coerce the TLD string into a valid ROID suffix.
|
||||
String roidSuffix =
|
||||
Ascii.toUpperCase(tld.replaceFirst(ACE_PREFIX_REGEX, "").replace('.', '_'))
|
||||
.replace('-', '_');
|
||||
createTld(tld, roidSuffix.length() > 8 ? roidSuffix.substring(0, 8) : roidSuffix, tldStates);
|
||||
}
|
||||
|
||||
public static void createTld(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue