[bugfix] use start + end line in regex when validating emoji via API (#2671)

This commit is contained in:
tobi
2024-02-20 11:46:04 +01:00
committed by GitHub
parent ddfc725744
commit 65a273bc39
3 changed files with 61 additions and 3 deletions

View File

@@ -191,7 +191,7 @@ func CustomCSS(customCSS string) error {
// for emoji shortcodes, to figure out whether it's a valid shortcode, ie., 2-30 characters,
// a-zA-Z, numbers, and underscores.
func EmojiShortcode(shortcode string) error {
if !regexes.EmojiShortcode.MatchString(shortcode) {
if !regexes.EmojiValidator.MatchString(shortcode) {
return fmt.Errorf("shortcode %s did not pass validation, must be between 2 and 30 characters, letters, numbers, and underscores only", shortcode)
}
return nil