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

tokarchuk/v1.17
Lunny Xiao 8 years ago committed by GitHub
parent d2165a5890
commit c1d5983d3e
  1. 4
      routers/api/v1/user/repo.go

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

Loading…
Cancel
Save