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.
master
Alejandro Sirgo Rica 2024-06-05 10:58:22 +02:00
parent 4c97b671aa
commit acd6d20eeb
1 changed files with 4 additions and 0 deletions

View File

@ -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'))