From 6fa7082833812c734aeef8ad24477823ee766f1b Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Wed, 26 Apr 2017 23:11:32 +0900 Subject: fix reaction's name validation with + sign in it (#6221) --- api4/context.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'api4/context.go') diff --git a/api4/context.go b/api4/context.go index c7fba4f5f..5522d1836 100644 --- a/api4/context.go +++ b/api4/context.go @@ -6,6 +6,7 @@ package api4 import ( "fmt" "net/http" + "regexp" "strings" "time" @@ -504,7 +505,9 @@ func (c *Context) RequireEmojiName() *Context { return c } - if len(c.Params.EmojiName) == 0 || len(c.Params.EmojiName) > 64 || !model.IsValidAlphaNumHyphenUnderscore(c.Params.EmojiName, false) { + validName := regexp.MustCompile(`^[a-zA-Z0-9\-\+_]+$`) + + if len(c.Params.EmojiName) == 0 || len(c.Params.EmojiName) > 64 || !validName.MatchString(c.Params.EmojiName) { c.SetInvalidUrlParam("emoji_name") } -- cgit v1.2.3-1-g7c22