Skip to content

Commit ae6a524

Browse files
authored
Fix panic in team repos API (#19431)
* Fix panic in team repos API * Fix pagination * fmt
1 parent 409ff55 commit ae6a524

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

models/organization/team_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) ([]*r
4848
)
4949
}
5050
if opts.PageSize > 0 {
51-
sess.Limit(opts.PageSize, opts.Page*opts.PageSize)
51+
sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
5252
}
5353
var repos []*repo_model.Repository
5454
return repos, sess.OrderBy("repository.name").

routers/api/v1/org/team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ func GetTeamRepos(ctx *context.APIContext) {
545545
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
546546
return
547547
}
548-
repos := make([]*api.Repository, len(team.Repos))
548+
repos := make([]*api.Repository, len(teamRepos))
549549
for i, repo := range teamRepos {
550550
access, err := models.AccessLevel(ctx.Doer, repo)
551551
if err != nil {

routers/web/misc/markdown.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
api "code.gitea.io/gitea/modules/structs"
1717
"code.gitea.io/gitea/modules/util"
1818
"code.gitea.io/gitea/modules/web"
19+
1920
"mvdan.cc/xurls/v2"
2021
)
2122

0 commit comments

Comments
 (0)