Merge pull request #1324 from domXmob/master

fix of issue #1261 & #1321
This commit is contained in:
Matt Scott 2022-12-12 14:21:55 -05:00 committed by GitHub
commit 10fd8b1563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: powerdnsadmin
image: ngoduykhanh/powerdns-admin
image: powerdnsadmin/pda-legacy
ports:
- containerPort: 80
protocol: TCP

View File

@ -2,7 +2,7 @@ version: "3"
services:
app:
image: ngoduykhanh/powerdns-admin:latest
image: powerdnsadmin/pda-legacy:latest
container_name: powerdns_admin
ports:
- "9191:80"

View File

@ -119,16 +119,12 @@ def fetch_json(remote_url,
def display_record_name(data):
# Check that the data argument is a tuple containing two elements
if isinstance(data, Iterable) and len(data) == 2:
record_name, domain_name = data
if record_name == domain_name:
return '@'
else:
return record_name
record_name, domain_name = data
if record_name == domain_name:
return '@'
else:
# If data is not a tuple of length 2, return an empty string
return ''
return re.sub('\.{}$'.format(domain_name), '', record_name)
def display_master_name(data):
"""
@ -262,18 +258,24 @@ def pretty_domain_name(value):
raise Exception('Require the Punycode in string format')
def to_idna(value, action):
splits = value.split()
splits = value.split('.')
result = []
if action == 'encode':
for split in splits:
try:
# Try encoding to idna
result.append(idna.encode(split).decode())
if not split.startswith('_') and not split.startswith('-'):
result.append(idna.encode(split).decode())
else:
result.append(split)
except idna.IDNAError:
result.append(split)
elif action == 'decode':
for split in splits:
result.append(idna.decode(split))
if not split.startswith('_') and not split.startswith('--'):
result.append(idna.decode(split))
else:
result.append(split)
else:
raise Exception('No valid action received')
return ' '.join(result)
return '.'.join(result)