Skip to content

Commit 061c501

Browse files
lunnylafriks
authored andcommitted
Fix error when add user has full name to team (#2973)
* fix error when add user has full name to team * add comment for extra uname check
1 parent 16c55e1 commit 061c501

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routers/org/teams.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package org
66

77
import (
88
"path"
9+
"strings"
910

1011
"github.com/Unknwon/com"
1112

@@ -76,6 +77,10 @@ func TeamsAction(ctx *context.Context) {
7677
return
7778
}
7879
uname := ctx.Query("uname")
80+
// uname may be formatted as "username (fullname)"
81+
if strings.Contains(uname, "(") && strings.HasSuffix(uname, ")") {
82+
uname = strings.TrimSpace(strings.Split(uname, "(")[0])
83+
}
7984
var u *models.User
8085
u, err = models.GetUserByName(uname)
8186
if err != nil {

0 commit comments

Comments
 (0)