domain stripping was not limited to the end of a name

This commit is contained in:
Kees Monshouwer 2018-04-12 02:20:49 +02:00 committed by mind04
parent a12af5345d
commit df9e392e26
No known key found for this signature in database
GPG Key ID: 2698B1807E43953E
2 changed files with 3 additions and 3 deletions

View File

@ -130,7 +130,7 @@ def display_record_name(data):
if record_name == domain_name:
return '@'
else:
return record_name.replace('.'+domain_name, '')
return re.sub('\.{}$'.format(domain_name), '', record_name)
def display_master_name(data):

View File

@ -917,14 +917,14 @@ def create_template_from_zone():
if NEW_SCHEMA:
for jr in jrecords:
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
name = '@' if jr['name'] == domain_name else jr['name'].replace('.'+domain_name, '')
name = '@' if jr['name'] == domain_name else re.sub('\.{}$'.format(domain_name), '', jr['name'])
for subrecord in jr['records']:
record = DomainTemplateRecord(name=name, type=jr['type'], status=True if subrecord['disabled'] else False, ttl=jr['ttl'], data=subrecord['content'])
records.append(record)
else:
for jr in jrecords:
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
name = '@' if jr['name'] == domain_name else jr['name'].replace('.'+domain_name, '')
name = '@' if jr['name'] == domain_name else re.sub('\.{}$'.format(domain_name), '', jr['name'])
record = DomainTemplateRecord(name=name, type=jr['type'], status=True if jr['disabled'] else False, ttl=jr['ttl'], data=jr['content'])
records.append(record)