From 9d5ef117a2366d130bddd60b71d52a0e7d93c4b7 Mon Sep 17 00:00:00 2001 From: Patrick Schratz Date: Tue, 7 Nov 2023 20:18:42 +0100 Subject: [PATCH] Fix listing Gitea repos (#2768) --- server/forge/gitea/gitea.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/server/forge/gitea/gitea.go b/server/forge/gitea/gitea.go index 9962b6bc4..b8db0f93f 100644 --- a/server/forge/gitea/gitea.go +++ b/server/forge/gitea/gitea.go @@ -259,7 +259,7 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) return nil, err } - return shared_utils.Paginate(func(page int) ([]*model.Repo, error) { + repos, err := shared_utils.Paginate(func(page int) ([]*gitea.Repository, error) { repos, _, err := client.ListMyRepos( gitea.ListReposOptions{ ListOptions: gitea.ListOptions{ @@ -268,15 +268,17 @@ func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) }, }, ) - result := make([]*model.Repo, 0, len(repos)) - for _, repo := range repos { - if repo.Archived { - continue - } - result = append(result, toRepo(repo)) - } - return result, err + return repos, err }) + + result := make([]*model.Repo, 0, len(repos)) + for _, repo := range repos { + if repo.Archived { + continue + } + result = append(result, toRepo(repo)) + } + return result, err } // File fetches the file from the Gitea repository and returns its contents.