Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
-
dac89332
by lovetox at 2020-08-26T09:35:07+02:00
1 changed file:
Changes:
| ... | ... | @@ -721,19 +721,19 @@ def validate_domainpart(domainpart): |
| 721 | 721 |
if GLib.hostname_is_ip_address(ip_address):
|
| 722 | 722 |
return ip_address
|
| 723 | 723 |
|
| 724 |
+ length = len(domainpart.encode())
|
|
| 725 |
+ if length == 0 or length > 1023:
|
|
| 726 |
+ raise DomainpartByteLimit
|
|
| 727 |
+ |
|
| 724 | 728 |
if domainpart.endswith('.'): # RFC7622, 3.2
|
| 725 | 729 |
domainpart = domainpart[:-1]
|
| 726 | 730 |
|
| 727 | 731 |
try:
|
| 728 |
- domainpart = idna.encode(domainpart, uts46=True)
|
|
| 732 |
+ idna.encode(domainpart, uts46=True)
|
|
| 729 | 733 |
except Exception:
|
| 730 | 734 |
raise DomainpartNotAllowedChar
|
| 731 | 735 |
|
| 732 |
- length = len(domainpart)
|
|
| 733 |
- if length == 0 or length > 1023:
|
|
| 734 |
- raise DomainpartByteLimit
|
|
| 735 |
- |
|
| 736 |
- return domainpart.decode()
|
|
| 736 |
+ return domainpart
|
|
| 737 | 737 |
|
| 738 | 738 |
|
| 739 | 739 |
class JID:
|