From 7cc7db73b922143a1288d26b39eee9e8e59f7106 Mon Sep 17 00:00:00 2001 From: Xinyu Zhou Date: Wed, 28 Dec 2022 05:21:14 +0800 Subject: Add option to prohibit fork if user reached maximum limit of repositories (#21848) If user has reached the maximum limit of repositories: - Before - disallow create - allow fork without limit - This patch: - disallow create - disallow fork - Add option `ALLOW_FORK_WITHOUT_MAXIMUM_LIMIT` (Default **true**) : enable this allow user fork repositories without maximum number limit fixed https://github.com/go-gitea/gitea/issues/21847 Signed-off-by: Xinyu Zhou --- routers/api/v1/repo/fork.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'routers/api') diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go index f2cd10e711..97c1dc7ba7 100644 --- a/routers/api/v1/repo/fork.go +++ b/routers/api/v1/repo/fork.go @@ -141,7 +141,7 @@ func CreateFork(ctx *context.APIContext) { Description: repo.Description, }) if err != nil { - if repo_model.IsErrRepoAlreadyExist(err) { + if repo_model.IsErrReachLimitOfRepo(err) || repo_model.IsErrRepoAlreadyExist(err) { ctx.Error(http.StatusConflict, "ForkRepository", err) } else { ctx.Error(http.StatusInternalServerError, "ForkRepository", err) -- cgit v1.2.3