diff options
Diffstat (limited to 'internal/validate/formvalidation.go')
-rw-r--r-- | internal/validate/formvalidation.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/validate/formvalidation.go b/internal/validate/formvalidation.go index ccf5e6504..5d6e3142c 100644 --- a/internal/validate/formvalidation.go +++ b/internal/validate/formvalidation.go @@ -42,6 +42,7 @@ const ( maximumSiteTermsLength = 5000 maximumUsernameLength = 64 maximumCustomCSSLength = 5000 + maximumEmojiCategoryLength = 64 ) // NewPassword returns an error if the given password is not sufficiently strong, or nil if it's ok. @@ -182,6 +183,14 @@ func EmojiShortcode(shortcode string) error { return nil } +// EmojiCategory validates the length of the given category string. +func EmojiCategory(category string) error { + if length := len(category); length > maximumEmojiCategoryLength { + return fmt.Errorf("emoji category %s did not pass validation, must be less than %d characters, but provided value was %d characters", category, maximumEmojiCategoryLength, length) + } + return nil +} + // SiteTitle ensures that the given site title is within spec. func SiteTitle(siteTitle string) error { if length := len([]rune(siteTitle)); length > maximumSiteTitleLength { |