mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
Merge pull request #1324 from domXmob/master
fix of issue #1261 & #1321
This commit is contained in:
commit
10fd8b1563
@ -18,7 +18,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: powerdnsadmin
|
||||
image: ngoduykhanh/powerdns-admin
|
||||
image: powerdnsadmin/pda-legacy
|
||||
ports:
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user