Skip to content

Commit a9d547f

Browse files
GiteaBotlunny
andauthored
When comparing with an non-exist repository, return 404 but 500 (#27437) (#27442)
Backport #27437 by @lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 51001d9 commit a9d547f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

routers/web/repo/compare.go

+3-1
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)