From 4acb37d8c573f19f25fdaa1c0ecd0125ba45e79b Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Thu, 18 Jan 2024 10:18:40 +0100 Subject: views: fix client update form crashing Fix client update view crashing due to missing images variable. Check if GET /images fails. --- ogcp/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index 9aaef17..c0b2c98 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1009,6 +1009,12 @@ def action_client_update(): if setup and setup[0].get('code') == 'MSDOS': setup[0]['code'] = 'MBR' + r = server.get('/images') + if r.status_code != requests.codes.ok: + flash(_('ogServer: error retrieving images list'), + category='error') + return redirect(url_for('scopes')) + images = r.json()['images'] for entry in setup: if images and entry['image'] != 0: image = next((img for img in images if img['id'] == entry['image']), None) -- cgit v1.2.3-18-g5258