mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Return 409 when creating repo if it already exists. (#6330)
This commit is contained in:
committed by
techknowlogick
parent
7780ea8890
commit
583968f274
@ -226,8 +226,9 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
|
||||
AutoInit: opt.AutoInit,
|
||||
})
|
||||
if err != nil {
|
||||
if models.IsErrRepoAlreadyExist(err) ||
|
||||
models.IsErrNameReserved(err) ||
|
||||
if models.IsErrRepoAlreadyExist(err) {
|
||||
ctx.Error(409, "", "The repository with the same name already exists.")
|
||||
} else if models.IsErrNameReserved(err) ||
|
||||
models.IsErrNamePatternNotAllowed(err) {
|
||||
ctx.Error(422, "", err)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user