summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorBogdan Petrea <bogdan@presslabs.com>2019-03-15 14:19:09 +0000
committertechknowlogick <matti@mdranta.net>2019-03-15 10:19:09 -0400
commit583968f274b85d1c9184c614cbdae763899f7827 (patch)
treece8b6dbb8af569f777e3c8fd66159666e40a0d7b /routers/api
parent7780ea88907197abf6166bedc8b3021489444ea3 (diff)
downloadgitea-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.go5
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 {