utils: allow empty CSS in validator

This commit is contained in:
Lephe 2021-07-08 17:34:07 +02:00
parent b31ed9bec2
commit c4c9421beb
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ def css(form, css):
prop = r'[a-zA-Z-]+\s*:\s*[^;{}\'"]+'
stylesheet = rf'\s*(?:{prop};\s*)*{prop};?\s*'
if re.fullmatch(stylesheet, css.data) is None:
if css.data and re.fullmatch(stylesheet, css.data) is None:
raise ValidationError('CSS invalide (les caractères ;{}\'" sont '+\
'interdits dans les valeurs)')
return True