From acd6d20eeb0428ddb97b87471dfc66e2fec6945f Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Wed, 5 Jun 2024 10:58:22 +0200 Subject: views: Prevent zero or negative size partitions Defining a partition size <1 causes the partition to show with a different configuration to the one configured in the form. Any <1 size partition shows as Linux, Empty and the size field without value. Validate the form so we refuse any partition with size <1. --- ogcp/views.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ogcp/views.py') diff --git a/ogcp/views.py b/ogcp/views.py index 16e39b6..dc8d3d0 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -653,6 +653,10 @@ def action_setup_modify(): flash(_('The EFI partition requires a FAT32 filesystem'), category='error') return redirect(url_for('commands')) + if partition.size.data <= 0: + flash(_('Partitions can\'t have a size of zero or lower'), category='error') + return redirect(url_for('commands')) + if cache_count == 0: flash(_(f'Missing cache partition'), category='error') return redirect(url_for('commands')) -- cgit v1.2.3-18-g5258