From 1d20af3af8b7a3036d898f35d5204e5104621e22 Mon Sep 17 00:00:00 2001 From: pangliang <418094911@qq.com> Date: Sat, 9 Mar 2024 09:17:31 +0800 Subject: [PATCH] GetTagNamesByRepoID error handle as branch --- routers/web/repo/actions/actions.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index 38f2579c46..1bfc66de91 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -170,7 +170,7 @@ func List(ctx *context.Context) { } branches, err := git_model.FindBranchNames(ctx, branchOpts) if err != nil { - ctx.JSON(http.StatusInternalServerError, err) + ctx.ServerError("FindBranchNames", err) return } // always put default branch on the top if it exists @@ -181,9 +181,11 @@ func List(ctx *context.Context) { ctx.Data["Branches"] = branches tags, err := repo_model.GetTagNamesByRepoID(ctx, ctx.Repo.Repository.ID) - if err == nil { - ctx.Data["Tags"] = tags + if err != nil { + ctx.ServerError("GetTagNamesByRepoID", err) + return } + ctx.Data["Tags"] = tags } } }