summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2022-02-27 13:17:42 +0100
committerGitHub <noreply@github.com>2022-02-27 20:17:42 +0800
commit1563a45623bd3cea617b2a4395bcf3477023c6f2 (patch)
tree7ca09734eaf22d7c12738778b8614bb0735e420e /routers
parent3ba9dcf4b4c82f2fa047e1278115b9e6b5464d53 (diff)
downloadgitea-1563a45623bd3cea617b2a4395bcf3477023c6f2.tar.gz
gitea-1563a45623bd3cea617b2a4395bcf3477023c6f2.zip
Fix page and missing return on unadopted repos API (#18848)
* Fix page and missing return on unadopted repos API Page must be 1 if it's not specified and it should return after sending an internal server error. * Allow ignore pages Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/admin/adopt.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/api/v1/admin/adopt.go b/routers/api/v1/admin/adopt.go
index 1c0e237cdb..db1754c8d0 100644
--- a/routers/api/v1/admin/adopt.go
+++ b/routers/api/v1/admin/adopt.go
@@ -43,9 +43,13 @@ func ListUnadoptedRepositories(ctx *context.APIContext) {
// "$ref": "#/responses/forbidden"
listOptions := utils.GetListOptions(ctx)
+ if listOptions.Page == 0 {
+ listOptions.Page = 1
+ }
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx.FormString("query"), &listOptions)
if err != nil {
ctx.InternalServerError(err)
+ return
}
ctx.SetTotalCountHeader(int64(count))