From 41728b7901885d3dd6fcd5d0ca138d7702f2d727 Mon Sep 17 00:00:00 2001 From: Stephan de Wit Date: Fri, 21 Apr 2023 10:09:25 +0200 Subject: [PATCH] unbound: dnsbl_module: (test-mode) assume a query can pass if a blocklist file is empty --- .../service/templates/OPNsense/Unbound/core/dnsbl_module.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opnsense/service/templates/OPNsense/Unbound/core/dnsbl_module.py b/src/opnsense/service/templates/OPNsense/Unbound/core/dnsbl_module.py index 8463dde83..1f6608ce1 100644 --- a/src/opnsense/service/templates/OPNsense/Unbound/core/dnsbl_module.py +++ b/src/opnsense/service/templates/OPNsense/Unbound/core/dnsbl_module.py @@ -562,6 +562,10 @@ def arg_parse_is_json_file(filename): json.load(open(filename)) except FileNotFoundError: raise argparse.ArgumentTypeError("non existing file") + except json.JSONDecodeError: + # in cases where a file exists, but we're unable to decode it (e.g. the file is empty), + # we should assume the blocklist has no entries. + pass except: raise argparse.ArgumentTypeError("No blocklist available")