fix(ansibleserver): add LF for privateKey if not

This commit is contained in:
rainzm
2021-04-26 18:59:44 +08:00
parent 7b0f45261d
commit 4088e47f92
@@ -87,6 +87,10 @@ func (v *ValidatorAnsiblePlaybook) Validate(data *jsonutils.JSONDict) error {
}
}
}
// add LF for privateKey
if len(pb.PrivateKey) > 0 && pb.PrivateKey[len(pb.PrivateKey)-1] != 10 {
pb.PrivateKey = append(pb.PrivateKey, 10)
}
pbJson := jsonutils.Marshal(pb)
if serialized := pbJson.String(); len(serialized) > PlaybookMaxBytes {
return httperrors.NewBadRequestError("playbook too big, got %d bytes, exceeding %d",