fix: trim the whitespaces for the search keyword (#893)

This commit is contained in:
Bo-Yi Wu 2017-02-11 12:00:01 +08:00 committed by Lunny Xiao
parent 55f2059f71
commit 3576e1ee73
7 changed files with 14 additions and 11 deletions

View file

@ -5,6 +5,8 @@
package user
import (
"strings"
"github.com/Unknwon/com"
api "code.gitea.io/sdk/gitea"
@ -16,7 +18,7 @@ import (
// Search search users
func Search(ctx *context.APIContext) {
opts := &models.SearchUserOptions{
Keyword: ctx.Query("q"),
Keyword: strings.Trim(ctx.Query("q"), " "),
Type: models.UserTypeIndividual,
PageSize: com.StrTo(ctx.Query("limit")).MustInt(),
}