mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02: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:
parent
861fd60d2c
commit
f1ad34b12f
5 changed files with 24 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue