aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/setting.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r--routers/repo/setting.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 80a064492e..2354fbc13f 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -113,7 +113,11 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
return
} else if err = models.TransferOwnership(ctx.Repo.Owner, newOwner, ctx.Repo.Repository); err != nil {
- ctx.Handle(500, "TransferOwnership", err)
+ if err == models.ErrRepoAlreadyExist {
+ ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)
+ } else {
+ ctx.Handle(500, "TransferOwnership", err)
+ }
return
}
log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newOwner)