mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-22 23:23:50 +02:00
fix(api): return 4xx for invalid fork repository names (#39909)
Fixes #39908 --------- Signed-off-by: Ferdinand-MZ <ferdinandmaulanazafauzi@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
1 parent
3648598d7d
commit
a6bc03cce1
1 file changed
+1
-8
@@ -12,7 +12,6 @@ import (
|
||||
"gitea.dev/models/perm"
|
||||
access_model "gitea.dev/models/perm/access"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/optional"
|
||||
api "gitea.dev/modules/structs"
|
||||
"gitea.dev/modules/util"
|
||||
@@ -166,13 +165,7 @@ func CreateFork(ctx *context.APIContext) {
|
||||
Description: repo.Description,
|
||||
})
|
||||
if err != nil {
|
||||
if errors.Is(err, util.ErrAlreadyExist) || repo_model.IsErrReachLimitOfRepo(err) {
|
||||
ctx.APIError(http.StatusConflict, err.Error())
|
||||
} else if errors.Is(err, user_model.ErrBlockedUser) {
|
||||
ctx.APIError(http.StatusForbidden, err.Error())
|
||||
} else {
|
||||
ctx.APIErrorInternal(err)
|
||||
}
|
||||
ctx.APIErrorAuto(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user