Firewall/alias, disabled alias should leave us with an empty one, for https://github.com/opnsense/core/issues/2860

This commit is contained in:
Ad Schellevis 2018-10-30 09:27:45 +01:00
parent 9ee4921d42
commit 1d9b7ef480
2 changed files with 5 additions and 1 deletions

View File

@ -70,6 +70,8 @@ class Alias(object):
tmp = subelem.text.strip()
if len(tmp.split('.')) <= 2 and tmp.replace('.', '').isdigit():
self._ttl = int(float(tmp))
elif subelem.tag in ('aliasurl', 'address', 'url') and subelem.text is None:
self._items = set()
elif subelem.tag == 'aliasurl':
self._items = set(sorted(subelem.text.split()))
elif subelem.tag == 'address' and len(self._items) == 0:

View File

@ -13,7 +13,9 @@
<name>{{ alias.name|e }}</name>
<descr>{{ alias.description|default('')|e}}</descr>
<type>{{ alias.type }}</type>
{% if alias.type.startswith('urltable') %}
{% if alias.enabled|default('0') == '0'%}
<address></address>
{% elif alias.type.startswith('urltable') %}
<url>{{ alias.content|e }}</url>
{% elif alias.type.startswith('url') %}
<aliasurl>{{ alias.content|e }}</aliasurl>