mirror of https://github.com/openspug/spug
U 优化表单数据校验
parent
c82906a5df
commit
c8e6849847
|
@ -29,6 +29,7 @@ class AppView(View):
|
|||
Argument('desc', required=False)
|
||||
).parse(request.body)
|
||||
if error is None:
|
||||
form.name = form.name.replace("'", '')
|
||||
app = App.objects.filter(key=form.key).first()
|
||||
if app and app.id != form.id:
|
||||
return json_response(error=f'唯一标识符 {form.key} 已存在,请更改后重试')
|
||||
|
|
|
@ -25,6 +25,7 @@ class EnvironmentView(View):
|
|||
Argument('desc', required=False)
|
||||
).parse(request.body)
|
||||
if error is None:
|
||||
form.key = form.key.replace("'", '')
|
||||
env = Environment.objects.filter(key=form.key).first()
|
||||
if env and env.id != form.id:
|
||||
return json_response(error=f'唯一标识符 {form.key} 已存在,请更改后重试')
|
||||
|
|
|
@ -67,10 +67,13 @@ class RequestView(View):
|
|||
if form.extra[0] == 'branch' and not form.extra[2]:
|
||||
return json_response(error='请选择要发布的分支及Commit ID')
|
||||
if deploy.extend == '2':
|
||||
if form.extra[0]:
|
||||
form.extra[0] = form.extra[0].replace("'", '')
|
||||
if DeployExtend2.objects.filter(host_actions__contains='"src_mode": "1"').exists():
|
||||
if len(form.extra) < 2:
|
||||
return json_response(error='该应用的发布配置中使用了数据传输动作且设置为发布时上传,请上传要传输的数据')
|
||||
form.version = form.extra[1].get('path')
|
||||
form.name = form.name.replace("'", '')
|
||||
form.status = '0' if deploy.is_audit else '1'
|
||||
form.extra = json.dumps(form.extra)
|
||||
form.host_ids = json.dumps(form.host_ids)
|
||||
|
|
Loading…
Reference in New Issue