From e3a71a851d57997d0f4bc989ebb9dbea439fb64b Mon Sep 17 00:00:00 2001 From: Ruben van Staveren Date: Fri, 11 Mar 2022 22:04:48 +0100 Subject: [PATCH] Allowed methods are listed in app.route, elif is noop here --- jail2ban/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jail2ban/__init__.py b/jail2ban/__init__.py index 1716123..dec322c 100644 --- a/jail2ban/__init__.py +++ b/jail2ban/__init__.py @@ -77,7 +77,7 @@ def create_app(): ]) res = pfctl_cfg_write(f'f2b-jail/{remote_user}', b'\n'.join(cfg) + b'\n') - elif request.method == 'DELETE': + else: # 'DELETE': cfg = [cfg_line for cfg_line in cfg if cfg_line.find(bytes(f'', 'ascii')) == -1] res = pfctl_cfg_write(f'f2b-jail/{remote_user}', @@ -110,7 +110,7 @@ def create_app(): table=f'f2b-{name}', operation='add', value=str(ip)) - elif request.method == 'DELETE': + else: # 'DELETE': app.logger.info(f'Remove {ip} from f2b-{name}' f' in anchor f2b-jail/{remote_user}') res = pfctl_table_op(f'f2b-jail/{remote_user}',