mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
no spaces-only questions
This commit is contained in:
parent
1bf3f038fc
commit
ab726bc720
1 changed files with 5 additions and 3 deletions
8
app.py
8
app.py
|
@ -587,10 +587,12 @@ def addQuestion():
|
|||
question = request.form.get('question', '')
|
||||
cw = request.form.get('cw', '')
|
||||
|
||||
if not question:
|
||||
abort(400, "Question field must not be empty")
|
||||
question_normalized = unicodedata.normalize('NFKC', question).replace("⠀", "").strip()
|
||||
|
||||
if not question or not question_normalized:
|
||||
abort(400, _("Question field must not be empty"))
|
||||
if len(question) > int(cfg['charLimit']) or len(from_who) > int(cfg['charLimit']):
|
||||
abort(400, "Question exceeds the character limit")
|
||||
abort(400, _("Question exceeds the character limit"))
|
||||
return_val = func.addQuestion(from_who, question, cw)
|
||||
app.logger.debug("[CatAsk/API/add_question] finished question flow")
|
||||
return return_val[0]
|
||||
|
|
Loading…
Add table
Reference in a new issue