diff options
author | Unknwon <u@gogs.io> | 2015-08-05 11:14:17 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-05 11:14:17 +0800 |
commit | e50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84 (patch) | |
tree | f6dffcf1c5a273a077a8b33c75334b9994ca02ff /routers/api | |
parent | 487fc8ca39a3de565fc6c67aea72c4658bbf64c8 (diff) | |
download | gitea-e50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84.tar.gz gitea-e50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84.zip |
allow anonymous SSH clone
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo.go | 6 | ||||
-rw-r--r-- | routers/api/v1/user.go | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go index 7da5f81731..d683eac3f9 100644 --- a/routers/api/v1/repo.go +++ b/routers/api/v1/repo.go @@ -139,7 +139,7 @@ func CreateRepo(ctx *middleware.Context, opt api.CreateRepoOption) { func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { org, err := models.GetOrgByName(ctx.Params(":org")) if err != nil { - if err == models.ErrUserNotExist { + if models.IsErrUserNotExist(err) { ctx.Error(404) } else { ctx.Error(500) @@ -157,7 +157,7 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { u, err := models.GetUserByName(ctx.Query("username")) if err != nil { - if err == models.ErrUserNotExist { + if models.IsErrUserNotExist(err) { ctx.HandleAPI(422, err) } else { ctx.HandleAPI(500, err) @@ -174,7 +174,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { if form.Uid != u.Id { org, err := models.GetUserById(form.Uid) if err != nil { - if err == models.ErrUserNotExist { + if models.IsErrUserNotExist(err) { ctx.HandleAPI(422, err) } else { ctx.HandleAPI(500, err) diff --git a/routers/api/v1/user.go b/routers/api/v1/user.go index a4648297b9..feecda483d 100644 --- a/routers/api/v1/user.go +++ b/routers/api/v1/user.go @@ -61,7 +61,7 @@ func SearchUsers(ctx *middleware.Context) { func GetUserInfo(ctx *middleware.Context) { u, err := models.GetUserByName(ctx.Params(":username")) if err != nil { - if err == models.ErrUserNotExist { + if models.IsErrUserNotExist(err) { ctx.Error(404) } else { ctx.JSON(500, &base.ApiJsonErr{"GetUserByName: " + err.Error(), base.DOC_URL}) |