From 8bed6888094922d207b40d30837f52561f4f0470 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 12 2016 08:18:11 +0000 Subject: Specify the max length of the field so the input gets validated early --- diff --git a/pagure/forms.py b/pagure/forms.py index 523d49f..f3a2652 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -66,7 +66,10 @@ class ProjectFormSimplified(wtf.Form): ) tags = wtforms.TextField( 'Project tags', - [wtforms.validators.optional()] + [ + wtforms.validators.optional(), + wtforms.validators.Length(max=255), + ] ) @@ -153,7 +156,8 @@ class AddIssueTagForm(wtf.Form): 'tag', [ wtforms.validators.Optional(), - wtforms.validators.Regexp(TAGS_REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(TAGS_REGEX, flags=re.IGNORECASE), + wtforms.validators.Length(max=255), ] ) @@ -204,7 +208,8 @@ class UpdateIssueForm(wtf.Form): 'tag', [ wtforms.validators.Optional(), - wtforms.validators.Regexp(TAGS_REGEX, flags=re.IGNORECASE) + wtforms.validators.Regexp(TAGS_REGEX, flags=re.IGNORECASE), + wtforms.validators.Length(max=255), ] ) depends = wtforms.TextField( @@ -365,12 +370,14 @@ class EditGroupForm(wtf.Form): 'Group name to display', [ wtforms.validators.Required(), + wtforms.validators.Length(max=255), ] ) description = wtforms.TextField( 'Description', [ wtforms.validators.Required(), + wtforms.validators.Length(max=255), ] )