diff options
author | Chris Shyi <chrisshyi13@gmail.com> | 2020-10-12 21:44:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 14:44:56 +0100 |
commit | c752ccee6425091cf17c98029f039f3fe66552b4 (patch) | |
tree | 1fd499117672e13c6323f433577ad98f1d4a197d /routers/repo/setting.go | |
parent | 0e4f663126dbd39266e56203cca48b8a5aa85ee6 (diff) | |
download | gitea-c752ccee6425091cf17c98029f039f3fe66552b4.tar.gz gitea-c752ccee6425091cf17c98029f039f3fe66552b4.zip |
Improve error feedback for duplicate deploy keys (#13112)
Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template to inform the user that a key with the intended title already exists.
Fixes #13110
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r-- | routers/repo/setting.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index ca222375fb..1b75522958 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -885,6 +885,9 @@ func DeployKeysPost(ctx *context.Context, form auth.AddKeyForm) { case models.IsErrKeyNameAlreadyUsed(err): ctx.Data["Err_Title"] = true ctx.RenderWithErr(ctx.Tr("repo.settings.key_name_used"), tplDeployKeys, &form) + case models.IsErrDeployKeyNameAlreadyUsed(err): + ctx.Data["Err_Title"] = true + ctx.RenderWithErr(ctx.Tr("repo.settings.key_name_used"), tplDeployKeys, &form) default: ctx.ServerError("AddDeployKey", err) } |