Skip to content

Commit c1d5983

Browse files
authored
fix panic when get user repos from api (#1110)
1 parent d2165a5 commit c1d5983

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

routers/api/v1/user/repo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
2525
apiRepos[i] = ownRepos[i].APIFormat(models.AccessModeOwner)
2626
}
2727
// Set repositories user has access to.
28-
for i := len(ownRepos); i < len(apiRepos); i++ {
29-
apiRepos[i] = accessibleRepos[i]
28+
for i := 0; i < len(accessibleRepos); i++ {
29+
apiRepos[i+len(ownRepos)] = accessibleRepos[i]
3030
}
3131
ctx.JSON(200, &apiRepos)
3232
}

0 commit comments

Comments
 (0)