[fix] Pattern key not working

This commit is contained in:
ljf 2021-08-26 17:48:08 +02:00
parent 9eb9ec1804
commit 574b01bcf4

View file

@ -2876,7 +2876,7 @@ class YunoHostArgumentFormatParser(object):
if question.value is not None: if question.value is not None:
if question.choices and question.value not in question.choices: if question.choices and question.value not in question.choices:
self._raise_invalid_answer(question) self._raise_invalid_answer(question)
if question.pattern and re.match(question.pattern['regexp'], str(question.value)): if question.pattern and not re.match(question.pattern['regexp'], str(question.value)):
raise YunohostValidationError( raise YunohostValidationError(
question.pattern['error'], question.pattern['error'],
name=question.name, name=question.name,