mirror of
https://github.com/google/nomulus
synced 2026-02-03 11:32:24 +00:00
Enforce canonicalization of premium/reserved list labels
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=193401336
This commit is contained in:
@@ -41,7 +41,12 @@ public final class DomainNameUtils {
|
||||
|
||||
/** Canonicalizes a domain name by lowercasing and converting unicode to punycode. */
|
||||
public static String canonicalizeDomainName(String label) {
|
||||
return Idn.toASCII(Ascii.toLowerCase(label));
|
||||
String labelLowercased = Ascii.toLowerCase(label);
|
||||
try {
|
||||
return Idn.toASCII(labelLowercased);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException(String.format("Error ASCIIfying label '%s'", label), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user