pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python-validators/validators/commit/1efa47c441173599c5ca00682ac7bf19ce02cf1d

nk crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-b40ec823a1a6a1af.css" /> IDNA encoded tlds were note implemented correctly. · python-validators/validators@1efa47c · GitHub
Skip to content

Commit 1efa47c

Browse files
piewpiewkvesteri
authored andcommitted
IDNA encoded tlds were note implemented correctly.
Some specific correct domains where previously failing (like 'somerandomwebsite.xn--fiqs8s' which is not in the tests also). This solution has to cases for tlds: 1) Asci tlds: accepts any a-z or A-Z characters from 2 till 13 reps 2) IDNA tlds: must start with 'xn--' (ACE prefix) and then any a-z, A-Z and 0-9 from 2 till 30 reps
1 parent 92cda69 commit 1efa47c

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

tests/test_domain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
'xn----gtbspbbmkef.xn--p1ai',
1010
'underscore_subdomain.example.com',
1111
'something.versicherung',
12-
'11.com'
12+
'11.com',
13+
'somerandomexample.xn--fiqs8s'
1314
])
1415
def test_returns_true_on_valid_domain(value):
1516
assert domain(value)

validators/domain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from .utils import validator
44

55
pattern = re.compile(
6-
r'^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|'
7-
r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|'
8-
r'([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\.'
9-
r'([a-zA-Z]{2,13}|[a-zA-Z0-9-]{2,30}.[a-zA-Z]{2,3})$'
6+
r'^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|' # domain pt.1
7+
r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|' # domain pt.2
8+
r'([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\.' # domain pt.3
9+
r'([a-zA-Z]{2,13}|(xn--[a-zA-Z0-9]{2,30}))$' # TLD
1010
)
1111

1212

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy