From 9c07d909e6f307f0dc33951face750717cff8520 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 27 Nov 2017 01:53:07 +0800 Subject: [PATCH] Fix error when add user has full name to team (#2973) (#2975) * fix error when add user has full name to team * add comment for extra uname check --- routers/org/teams.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/org/teams.go b/routers/org/teams.go index 1ac4bff2e..e9abfe791 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -6,6 +6,7 @@ package org import ( "path" + "strings" "github.com/Unknwon/com" @@ -76,6 +77,10 @@ func TeamsAction(ctx *context.Context) { return } uname := ctx.Query("uname") + // uname may be formatted as "username (fullname)" + if strings.Contains(uname, "(") && strings.HasSuffix(uname, ")") { + uname = strings.TrimSpace(strings.Split(uname, "(")[0]) + } var u *models.User u, err = models.GetUserByName(uname) if err != nil {