From 062f758e47cda90a9ae783cbaee6bf3bec571178 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 21 Nov 2016 12:17:53 -0500 Subject: Fix user search when using an asterisk (#4586) --- store/sql_user_store.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'store/sql_user_store.go') diff --git a/store/sql_user_store.go b/store/sql_user_store.go index aa3bb4380..1a38e89e8 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -1217,11 +1217,24 @@ func (us SqlUserStore) SearchInChannel(channelId string, term string, options ma return storeChannel } +var specialUserSearchChar = []string{ + "<", + ">", + "+", + "-", + "(", + ")", + "~", + "@", + ":", + "*", +} + func (us SqlUserStore) performSearch(searchQuery string, term string, options map[string]bool, parameters map[string]interface{}) StoreResult { result := StoreResult{} // these chars have special meaning and can be treated as spaces - for _, c := range specialSearchChar { + for _, c := range specialUserSearchChar { term = strings.Replace(term, c, " ", -1) } -- cgit v1.2.3-1-g7c22