diff options
author | Bogdan Petrea <bogdan@presslabs.com> | 2019-03-15 14:19:09 +0000 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-15 10:19:09 -0400 |
commit | 583968f274b85d1c9184c614cbdae763899f7827 (patch) | |
tree | ce8b6dbb8af569f777e3c8fd66159666e40a0d7b /routers/api | |
parent | 7780ea88907197abf6166bedc8b3021489444ea3 (diff) | |
download | gitea-583968f274b85d1c9184c614cbdae763899f7827.tar.gz gitea-583968f274b85d1c9184c614cbdae763899f7827.zip |
Return 409 when creating repo if it already exists. (#6330)
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo/repo.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index c6a7803acb..e5922e77dc 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -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 { |