mirror of https://git.48k.eu/ogcp
views: report error when spaces are found in image name
Validate imagen names in POST /action/image/create. Remove spaces at the begining and end of the image name, then report error if the image name still contains space characters.master
parent
6f488ae251
commit
dd77bc380e
|
@ -1683,12 +1683,17 @@ def action_image_create():
|
|||
if r.status_code != requests.codes.ok:
|
||||
return ogserver_error('commands')
|
||||
|
||||
image_name = form.name.data.strip()
|
||||
if ' ' in image_name:
|
||||
flash(_('No spaces allowed in image names'), category='error')
|
||||
return redirect(url_for('commands'))
|
||||
|
||||
disk, partition, code = form.os.data.split(' ')
|
||||
payload = {"clients": [ip],
|
||||
"disk": disk,
|
||||
"partition": partition,
|
||||
"code": code,
|
||||
"name": form.name.data,
|
||||
"name": image_name,
|
||||
"repository_id": int(form.repository.data),
|
||||
"id": "0", # This is ignored by the server.
|
||||
"description": form.description.data,
|
||||
|
|
Loading…
Reference in New Issue