Skip to content

Commit

Permalink
fix(domain): accept .onion as a valid TLD
Browse files Browse the repository at this point in the history
  • Loading branch information
davidt99 committed Sep 15, 2024
1 parent dd11808 commit 0a791b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/validators/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class _IanaTLD:
_full_cache: Optional[Set[str]] = None
# source: https://www.statista.com/statistics/265677
_popular_cache = {"COM", "ORG", "RU", "DE", "NET", "BR", "UK", "JP", "FR", "IT"}
_popular_cache.add("ONION")

@classmethod
def _retrieve(cls):
Expand Down
1 change: 1 addition & 0 deletions tests/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_returns_true_on_valid_domain(value: str, rfc_1034: bool, rfc_2782: bool
("_example.com", True, False, True),
("example_.com", True, False, True),
("somerandomexample.xn--fiqs8s", True, False, False),
("somerandomexample.onion", True, False, False),
],
)
def test_returns_true_on_valid_top_level_domain(
Expand Down

0 comments on commit 0a791b6

Please sign in to comment.