mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 09:34:39 +00:00
configd, idna encode, orginating from https://github.com/opnsense/core/pull/3107 and other commits from the same contributor.
Fix for https://github.com/opnsense/core/pull/3107, although I'm doubting if we should keep supporting idna, since fixing these issues often cost us quite some time and demand for the feature doesn't appear to be very high.
This commit is contained in:
parent
ba2380a397
commit
00b46e0575
@ -67,8 +67,13 @@ class Template(object):
|
||||
def _encode_idna(x):
|
||||
""" encode string to idna, preserve leading dots
|
||||
"""
|
||||
tmp = b''.join([b''.join([b'.' for x in range(len(x) - len(x.lstrip('.')))]), x.lstrip('.').encode('idna')])
|
||||
return tmp.decode()
|
||||
try:
|
||||
tmp = b''.join([b''.join([b'.' for x in range(len(x) - len(x.lstrip('.')))]), x.lstrip('.').encode('idna')])
|
||||
return tmp.decode()
|
||||
except UnicodeError:
|
||||
# return source when unable to decode
|
||||
syslog.syslog(syslog.LOG_NOTICE, "encode idna: unable to decode %s, return source" % x)
|
||||
return x
|
||||
|
||||
def list_module(self, module_name):
|
||||
""" list single module content
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user