From 35269b31a736f72acd3b47d722f3ee7efd7fa86d Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 13 Feb 2025 14:57:23 +0100 Subject: [PATCH] views: validate client partitions in /action/software Redirect the user when /action/software is accessed on a client without valid partitions. --- ogcp/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index 5040bd3..6647c36 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1199,6 +1199,11 @@ def action_software(): f"| {PART_TYPE_CODES.get(part.get('code'), 'UNKNOWN')} " f"{FS_CODES.get(part.get('filesystem'), 'UNKNOWN')}") ) + + if not form.os.choices: + flash(_(f'No valid partition available'), category='error') + return redirect(url_for('commands')) + return render_template('actions/software.html', form=form, scopes=scopes) @app.route('/action/session', methods=['GET', 'POST'])