mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 23:11:10 +01:00
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
This commit is contained in:
parent
16c55e1a5b
commit
061c501d54
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,7 @@ package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
|
@ -76,6 +77,10 @@ func TeamsAction(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uname := ctx.Query("uname")
|
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
|
var u *models.User
|
||||||
u, err = models.GetUserByName(uname)
|
u, err = models.GetUserByName(uname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue