mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-06 12:49:31 -06:00
work on emojis
This commit is contained in:
parent
de9718c566
commit
32629a378d
31 changed files with 605 additions and 67 deletions
|
|
@ -142,3 +142,13 @@ func ValidatePrivacy(privacy string) error {
|
|||
// TODO: add some validation logic here -- length, characters, etc
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidateEmojiShortcode just runs the given shortcode through the regular expression
|
||||
// for emoji shortcodes, to figure out whether it's a valid shortcode, ie., 2-30 characters,
|
||||
// lowercase a-z, numbers, and underscores.
|
||||
func ValidateEmojiShortcode(shortcode string) error {
|
||||
if !emojiShortcodeRegex.MatchString(shortcode) {
|
||||
return fmt.Errorf("shortcode %s did not pass validation, must be between 2 and 30 characters, lowercase letters, numbers, and underscores only", shortcode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue