1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

When comparing with an non-exist repository, return 404 but 500 (#27437)

This commit is contained in:
Lunny Xiao 2023-10-04 21:59:03 +08:00 committed by GitHub
parent dd221b9aec
commit fe68bbeea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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