mirror of
https://github.com/go-gitea/gitea
synced 2024-11-11 12:31:24 +01:00
Fix panic in team repos API (#19431)
* Fix panic in team repos API * Fix pagination * fmt
This commit is contained in:
parent
409ff55a29
commit
ae6a52440a
3 changed files with 3 additions and 2 deletions
|
@ -48,7 +48,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) ([]*r
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if opts.PageSize > 0 {
|
if opts.PageSize > 0 {
|
||||||
sess.Limit(opts.PageSize, opts.Page*opts.PageSize)
|
sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
|
||||||
}
|
}
|
||||||
var repos []*repo_model.Repository
|
var repos []*repo_model.Repository
|
||||||
return repos, sess.OrderBy("repository.name").
|
return repos, sess.OrderBy("repository.name").
|
||||||
|
|
|
@ -545,7 +545,7 @@ func GetTeamRepos(ctx *context.APIContext) {
|
||||||
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
|
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
repos := make([]*api.Repository, len(team.Repos))
|
repos := make([]*api.Repository, len(teamRepos))
|
||||||
for i, repo := range teamRepos {
|
for i, repo := range teamRepos {
|
||||||
access, err := models.AccessLevel(ctx.Doer, repo)
|
access, err := models.AccessLevel(ctx.Doer, repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
|
|
||||||
"mvdan.cc/xurls/v2"
|
"mvdan.cc/xurls/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue