mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Improve LoadUnitConfig to handle invalid or duplicate units (#23736)
The old code just parses an invalid key to `TypeInvalid` and uses it as normal, and duplicate keys will be kept. So this PR will ignore invalid key and log warning and also deduplicate valid units.
This commit is contained in:
@@ -135,7 +135,7 @@ func GetTeam(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
func attachTeamUnits(team *organization.Team, units []string) {
|
||||
unitTypes := unit_model.FindUnitTypes(units...)
|
||||
unitTypes, _ := unit_model.FindUnitTypes(units...)
|
||||
team.Units = make([]*organization.TeamUnit, 0, len(units))
|
||||
for _, tp := range unitTypes {
|
||||
team.Units = append(team.Units, &organization.TeamUnit{
|
||||
|
Reference in New Issue
Block a user