views: Fix bug in client detail with non existing images

Fix client detail form failing in some cases. It would fail if the user
wanted to view the details of a client, that had a partition using an
image that is no longer in the list of all images stored by the servers.
This could happen if the image was deleted, but the client still was using
the image in one of its partitions
master v1.1.3-10
Javier Hernandez 2023-12-19 13:15:09 +01:00 committed by OpenGnSys Support Team
parent 3c7e3e1e3b
commit 906c3070ed
1 changed files with 5 additions and 2 deletions

View File

@ -888,8 +888,11 @@ def action_client_info():
for entry in setup:
if images and entry['image'] != 0:
image = next(img for img in images if img['id'] == entry['image'])
entry['image'] = image['name']
image = next((img for img in images if img['id'] == entry['image']), None)
if image:
entry['image'] = image['name']
else:
entry['image'] = ""
else:
entry['image'] = ""