Skip to content

Commit

Permalink
When comparing with an non-exist repository, return 404 but 500 (#27437)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Oct 4, 2023
1 parent dd221b9 commit fe68bbe
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 fe68bbe

Please sign in to comment.