From afab38b0d74c65e1deb4348a411cd3a13a641b74 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 8 Feb 2017 18:43:46 -0500 Subject: routers/repo/pull: fix 404 on PR compare (#4074) Due to recent code refactor, ctx.PullRequest is not initialized for route repo.CompareAndPullRequest, which leads the UI thinks the compare is not happening inside the same repository. The current fix is to allow compare URL to include redundant head user name so everything works fine again, but code logic isn't as clean as before. Made comments about possible future fix. --- cmd/web.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/web.go b/cmd/web.go index 49dbbf20..957c2468 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -525,6 +525,10 @@ func runWeb(ctx *cli.Context) error { ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount }) + // FIXME: Should use ctx.Repo.PullRequest to unify template, currently we have inconsistent URL + // for PR in same repository. After select branch on the page, the URL contains redundant head user name. + // e.g. /org1/test-repo/compare/master...org1:develop + // which should be /org1/test-repo/compare/master...develop m.Combo("/compare/*", repo.MustAllowPulls).Get(repo.CompareAndPullRequest). Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost) -- cgit v1.2.3