Skip to content

Commit

Permalink
When comparing with an non-exist repository, return 404 but 500 (go-g…
Browse files Browse the repository at this point in the history
…itea#27437) (go-gitea#27442)

Backport go-gitea#27437 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
GiteaBot and lunny committed Oct 4, 2023
1 parent 51001d9 commit a9d547f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a9d547f

Please sign in to comment.