Skip to content

Commit 973b7f6

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

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
@@ -251,7 +251,6 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
251251
isSameRepo = true
252252
ci.HeadUser = ctx.Repo.Owner
253253
ci.HeadBranch = headInfos[0]
254-
255254
} else if len(headInfos) == 2 {
256255
headInfosSplit := strings.Split(headInfos[0], "/")
257256
if len(headInfosSplit) == 1 {
@@ -406,6 +405,9 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
406405
return nil
407406
}
408407
defer ci.HeadGitRepo.Close()
408+
} else {
409+
ctx.NotFound("ParseCompareInfo", nil)
410+
return nil
409411
}
410412

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

0 commit comments

Comments
 (0)