Skip to content

Commit 1563a45

Browse files
qwerty287lunny
andauthored
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 <[email protected]>
1 parent 3ba9dcf commit 1563a45

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

integrations/api_repo_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ func TestAPIRepoTransfer(t *testing.T) {
468468
expectedStatus int
469469
}{
470470
// Disclaimer for test story: "user1" is an admin, "user2" is normal user and part of in owner team of org "user3"
471-
472471
// Transfer to a user with teams in another org should fail
473472
{ctxUserID: 1, newOwner: "user3", teams: &[]int64{5}, expectedStatus: http.StatusForbidden},
474473
// Transfer to a user with non-existent team IDs should fail

models/migrations/migrations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Version struct {
6161
// update minDBVersion accordingly
6262
var migrations = []Migration{
6363
// Gitea 1.5.0 ends at v69
64-
6564
// v70 -> v71
6665
NewMigration("add issue_dependencies", addIssueDependencies),
6766
// v71 -> v72

routers/api/v1/admin/adopt.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ func ListUnadoptedRepositories(ctx *context.APIContext) {
4343
// "$ref": "#/responses/forbidden"
4444

4545
listOptions := utils.GetListOptions(ctx)
46+
if listOptions.Page == 0 {
47+
listOptions.Page = 1
48+
}
4649
repoNames, count, err := repo_service.ListUnadoptedRepositories(ctx.FormString("query"), &listOptions)
4750
if err != nil {
4851
ctx.InternalServerError(err)
52+
return
4953
}
5054

5155
ctx.SetTotalCountHeader(int64(count))

0 commit comments

Comments
 (0)