Skip to content

Commit

Permalink
Merge pull request #402 from davidt99/master
Browse files Browse the repository at this point in the history
fix(domain): accept .onion as a valid TLD
  • Loading branch information
yozachar authored Sep 16, 2024
2 parents dd11808 + 0a791b6 commit 597a030
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 597a030

Please sign in to comment.