diff --git a/app.py b/app.py index ee084d8..de8ee63 100644 --- a/app.py +++ b/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]