1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 13:19:37 -05:00

fix panic when get user repos from api (#1110)

This commit is contained in:
Lunny Xiao 2017-03-03 19:10:46 +08:00 committed by GitHub
parent d2165a5890
commit c1d5983d3e

View file

@ -25,8 +25,8 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
apiRepos[i] = ownRepos[i].APIFormat(models.AccessModeOwner)
}
// Set repositories user has access to.
for i := len(ownRepos); i < len(apiRepos); i++ {
apiRepos[i] = accessibleRepos[i]
for i := 0; i < len(accessibleRepos); i++ {
apiRepos[i+len(ownRepos)] = accessibleRepos[i]
}
ctx.JSON(200, &apiRepos)
}