no spaces-only questions

This commit is contained in:
mst 2025-02-28 07:17:39 +03:00
parent 1bf3f038fc
commit ab726bc720
No known key found for this signature in database

8
app.py
View file

@ -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]