1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-22 07:17:05 +00:00

Don't crash if a custom DNS entry is not under a zone managed by the box, fixes #1961

This commit is contained in:
Joshua Tauberer 2021-10-22 18:39:53 -04:00
parent 65861c68b7
commit 34017548d5

View File

@ -330,7 +330,7 @@ def dns_get_records(qname=None, rtype=None):
r["sort-order"]["created"] = i
domain_sort_order = utils.sort_domains([r["qname"] for r in records], env)
for i, r in enumerate(sorted(records, key = lambda r : (
zones.index(r["zone"]),
zones.index(r["zone"]) if r.get("zone") else 0, # record is not within a zone managed by the box
domain_sort_order.index(r["qname"]),
r["rtype"]))):
r["sort-order"]["qname"] = i