mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 03:35:55 +01:00
#1032: legacy code can have duplicated IDs for same repository
This commit is contained in:
parent
4aafeace23
commit
6b70a0c0d9
@ -341,12 +341,15 @@ func teamToTeamRepo(x *xorm.Engine) error {
|
||||
orgID := com.StrTo(team["org_id"]).MustInt64()
|
||||
teamID := com.StrTo(team["id"]).MustInt64()
|
||||
|
||||
// #1032: legacy code can have duplicated IDs for same repository.
|
||||
mark := make(map[int64]bool)
|
||||
for _, idStr := range strings.Split(string(team["repo_ids"]), "|") {
|
||||
repoID := com.StrTo(strings.TrimPrefix(idStr, "$")).MustInt64()
|
||||
if repoID == 0 {
|
||||
if repoID == 0 || mark[repoID] {
|
||||
continue
|
||||
}
|
||||
|
||||
mark[repoID] = true
|
||||
teamRepos = append(teamRepos, &TeamRepo{
|
||||
OrgID: orgID,
|
||||
TeamID: teamID,
|
||||
|
Loading…
Reference in New Issue
Block a user