map: add int conversion before comparing zoom levels (#86631)
gitea/combo/pipeline/head This commit looks good
Details
gitea/combo/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7aff4544fc
commit
ec57e7c060
|
@ -132,9 +132,9 @@ class MapCellEditForm(forms.ModelForm):
|
|||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
initial_zoom = cleaned_data.get('initial_zoom')
|
||||
max_zoom = cleaned_data.get('max_zoom')
|
||||
min_zoom = cleaned_data.get('min_zoom')
|
||||
initial_zoom = int(cleaned_data['initial_zoom'])
|
||||
max_zoom = int(cleaned_data['max_zoom'])
|
||||
min_zoom = int(cleaned_data['min_zoom'])
|
||||
if min_zoom > max_zoom:
|
||||
raise ValidationError(
|
||||
_('Invalid zoom configuration: minimal zoom must be lower than maximal zoom')
|
||||
|
|
|
@ -367,3 +367,10 @@ def test_manager_map_edit_zoom_check(app, layer, admin_user):
|
|||
manager_submit_cell(resp.form, expect_errors=True)
|
||||
assert resp.status_int == 200
|
||||
assert 'Invalid zoom configuration: minimal zoom must be lower than maximal zoom' in resp.text
|
||||
|
||||
# String comparison problem #86631
|
||||
resp.form[f'cmaps_map-{cell.pk}-initial_zoom'] = 16
|
||||
resp.form[f'cmaps_map-{cell.pk}-min_zoom'] = 6
|
||||
resp.form[f'cmaps_map-{cell.pk}-max_zoom'] = 16
|
||||
manager_submit_cell(resp.form)
|
||||
assert resp.status_int == 200
|
||||
|
|
Loading…
Reference in New Issue