Skip to content

Commit 597a030

Browse files
authored
Merge pull request #402 from davidt99/master
fix(domain): accept .onion as a valid TLD
2 parents dd11808 + 0a791b6 commit 597a030

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/validators/domain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class _IanaTLD:
1616
_full_cache: Optional[Set[str]] = None
1717
# source: https://www.statista.com/statistics/265677
1818
_popular_cache = {"COM", "ORG", "RU", "DE", "NET", "BR", "UK", "JP", "FR", "IT"}
19+
_popular_cache.add("ONION")
1920

2021
@classmethod
2122
def _retrieve(cls):

tests/test_domain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_returns_true_on_valid_domain(value: str, rfc_1034: bool, rfc_2782: bool
4646
("_example.com", True, False, True),
4747
("example_.com", True, False, True),
4848
("somerandomexample.xn--fiqs8s", True, False, False),
49+
("somerandomexample.onion", True, False, False),
4950
],
5051
)
5152
def test_returns_true_on_valid_top_level_domain(

0 commit comments

Comments
 (0)