classify xn--90ae (бг) as a country-code TLD#409
Merged
Conversation
Contributor
|
The lists are derived automatically from It looks like xn--90ae is somehow not being classified correctly. Any fixes to the table need to be done by correcting the logic, otherwise they may be reverted when the lists are next regenerated. I'll have a look and see if I can find the problem. |
asf-gitbox-commits
pushed a commit
that referenced
this pull request
Jun 23, 2026
Contributor
|
Found the issue - the test did not check if the TLD was in the correct list. |
Contributor
|
Thanks for the report! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DomainValidator keeps the IANA TLD lists as sorted arrays and decides a TLD's category from which array holds it. While going over the IDN country-code entries I noticed бг (punycode xn--90ae) sitting in GENERIC_TLDS, even though its Cyrillic neighbours срб and бел are in COUNTRY_CODE_TLDS. бг is the ccTLD delegated to Bulgaria for the two-letter code BG, so isValidCountryCodeTld("xn--90ae") and isValidCountryCodeTld("бг") wrongly return false while isValidGenericTld("xn--90ae") returns true.
Moving the entry into COUNTRY_CODE_TLDS, in its sorted position so the binary-search lookup still holds, makes the per-category checks agree with the IANA delegation. isValidTld and isValid already returned true through the category OR, so only the category-specific methods change behaviour. Left as is, callers that branch on TLD category (treating ccTLDs differently from gTLDs) mishandle Bulgarian domains. Added the matching assertions to DomainValidatorTest.testTopLevelDomains.