mirror of
https://github.com/google/nomulus
synced 2026-01-10 07:57:58 +00:00
Fix RDAP quirks uncovered during documentation
There's no reason not to allow a one-character search string when there are no wildcards. And the ROID validity pattern did not allow underscores, which was causing problems with our ROIDs. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136256605
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
package google.registry.rdap;
|
||||
|
||||
import static google.registry.util.DomainNameUtils.ACE_PREFIX;
|
||||
|
||||
import google.registry.request.HttpException.UnprocessableEntityException;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -82,8 +84,7 @@ public final class RdapSearchPattern {
|
||||
* @throws UnprocessableEntityException if {@code pattern} does not meet the requirements of RFC
|
||||
* 7482
|
||||
*/
|
||||
public static RdapSearchPattern create(
|
||||
String pattern, boolean allowSuffix) throws UnprocessableEntityException {
|
||||
public static RdapSearchPattern create(String pattern, boolean allowSuffix) {
|
||||
String initialString;
|
||||
boolean hasWildcard;
|
||||
String suffix;
|
||||
@@ -112,14 +113,13 @@ public final class RdapSearchPattern {
|
||||
suffix = null;
|
||||
}
|
||||
initialString = pattern.substring(0, wildcardPos);
|
||||
}
|
||||
if (initialString.length() < 2) {
|
||||
throw new UnprocessableEntityException("At least two characters must be specified");
|
||||
}
|
||||
if (initialString.startsWith("xn--")
|
||||
&& (initialString.length() < 7)) {
|
||||
throw new UnprocessableEntityException(
|
||||
"At least seven characters must be specified for punycode domain searches");
|
||||
if (initialString.length() < 2) {
|
||||
throw new UnprocessableEntityException("At least two characters must be specified");
|
||||
}
|
||||
if (initialString.startsWith(ACE_PREFIX) && (initialString.length() < 7)) {
|
||||
throw new UnprocessableEntityException(
|
||||
"At least seven characters must be specified for punycode domain searches");
|
||||
}
|
||||
}
|
||||
return new RdapSearchPattern(initialString, hasWildcard, suffix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user