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
  • Loading branch information
lunny authored and GiteaBot committed Oct 4, 2023
1 parent 51001d9 commit 94a1524
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 94a1524

Please sign in to comment.