From 4923af32425b0a6f065e5a490d9eea68bc1da777 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sun, 20 Feb 2022 11:01:18 +0800 Subject: [PATCH] redirect .wiki/* ui link to /wiki fix #18590 Signed-off-by: a1012112796 <1012112796@qq.com> --- modules/context/repo.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/context/repo.go b/modules/context/repo.go index 355c40af8a693..cb68b4b0a43fb 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -440,6 +440,12 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { ctx.Repo.Owner = owner ctx.Data["Username"] = ctx.Repo.Owner.Name + // redirect link to wiki + if strings.HasSuffix(repoName, ".wiki") { + ctx.Redirect(strings.Replace(ctx.Req.RequestURI, ".wiki", "/wiki", 1)) + return + } + // Get repository. repo, err := repo_model.GetRepositoryByName(owner.ID, repoName) if err != nil {