1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00

Wrap normalize_ip in try..except (#1139)

closes #1134
This commit is contained in:
Michael Kroes 2017-04-03 22:53:53 +02:00 committed by Joshua Tauberer
parent 00c61dbcdd
commit a072730fb8

View File

@ -894,7 +894,10 @@ def run_and_output_changes(env, pool):
def normalize_ip(ip): def normalize_ip(ip):
# Use ipaddress module to normalize the IPv6 notation and ensure we are matching IPv6 addresses written in different representations according to rfc5952. # Use ipaddress module to normalize the IPv6 notation and ensure we are matching IPv6 addresses written in different representations according to rfc5952.
import ipaddress import ipaddress
return str(ipaddress.ip_address(ip)) try:
return str(ipaddress.ip_address(ip))
except:
return ip
class FileOutput: class FileOutput:
def __init__(self, buf, width): def __init__(self, buf, width):