diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-10-04 21:59:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 13:59:03 +0000 |
commit | fe68bbeea00fae788f66d379a6cce01d61e11906 (patch) | |
tree | 9b6ee25996a06e6fa083e81d8b39f79c8d5e0d96 /routers | |
parent | dd221b9aec6a827da395eaca4f521674bc5be34a (diff) | |
download | gitea-fe68bbeea00fae788f66d379a6cce01d61e11906.tar.gz gitea-fe68bbeea00fae788f66d379a6cce01d61e11906.zip |
When comparing with an non-exist repository, return 404 but 500 (#27437)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/compare.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 43b2715fd1..d66dd582a1 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -252,7 +252,6 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { isSameRepo = true ci.HeadUser = ctx.Repo.Owner ci.HeadBranch = headInfos[0] - } else if len(headInfos) == 2 { headInfosSplit := strings.Split(headInfos[0], "/") if len(headInfosSplit) == 1 { @@ -407,6 +406,9 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { return nil } defer ci.HeadGitRepo.Close() + } else { + ctx.NotFound("ParseCompareInfo", nil) + return nil } ctx.Data["HeadRepo"] = ci.HeadRepo |