From bcffdff1358ce4d7a7d26e84f19aca29f27687df Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 10 Oct 2024 11:48:29 +0200 Subject: views.py: prevent backtrace with unregistered client Add check to skip unregistered clients in get_server_data_from_scopes to prevent KeyError exception. --- ogcp/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index 899a3a9..8a7463a 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -608,6 +608,9 @@ def get_server_data_from_scopes(scopes, clients): ip_to_name = {ip: c['name'] for c in parse_scopes_from_tree(scopes, 'computer') for ip in c['ip']} for client in clients['clients']: + if not client['addr'] in ip_to_name: + continue + client['name'] = ip_to_name[client['addr']] server_id = client['server'].id if server_id not in servers_data: -- cgit v1.2.3-18-g5258