Skip to content

Commit fe68bbe

Browse files
authored
When comparing with an non-exist repository, return 404 but 500 (#27437)
1 parent dd221b9 commit fe68bbe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

routers/web/repo/compare.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
252252
isSameRepo = true
253253
ci.HeadUser = ctx.Repo.Owner
254254
ci.HeadBranch = headInfos[0]
255-
256255
} else if len(headInfos) == 2 {
257256
headInfosSplit := strings.Split(headInfos[0], "/")
258257
if len(headInfosSplit) == 1 {
@@ -407,6 +406,9 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
407406
return nil
408407
}
409408
defer ci.HeadGitRepo.Close()
409+
} else {
410+
ctx.NotFound("ParseCompareInfo", nil)
411+
return nil
410412
}
411413

412414
ctx.Data["HeadRepo"] = ci.HeadRepo

0 commit comments

Comments
 (0)