Return 409 when creating repo if it already exists. (#6330)
This commit is contained in:
parent
7780ea8890
commit
583968f274
2 changed files with 74 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue