diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-12-04 03:46:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 20:46:11 +0100 |
commit | aa79738a66265ed2a3c6ff95929ae35e8550d86c (patch) | |
tree | 3e763bd981ee8835d4d84a3a7d50314bd3cb9252 /routers | |
parent | 1a78e23355de554a360f65c1a4808ae812a68809 (diff) | |
download | gitea-aa79738a66265ed2a3c6ff95929ae35e8550d86c.tar.gz gitea-aa79738a66265ed2a3c6ff95929ae35e8550d86c.zip |
Fix the bug: no wiki page can be created if the repo didn't have any page yet. (#17894)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/wiki.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index 44914a3e3d..7db4394bab 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -409,12 +409,6 @@ func Wiki(ctx *context.Context) { ctx.Data["PageIsWiki"] = true ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived - if !ctx.Repo.Repository.HasWiki() { - ctx.Data["Title"] = ctx.Tr("repo.wiki") - ctx.HTML(http.StatusOK, tplWikiStart) - return - } - switch ctx.FormString("action") { case "_pages": WikiPages(ctx) @@ -438,6 +432,12 @@ func Wiki(ctx *context.Context) { return } + if !ctx.Repo.Repository.HasWiki() { + ctx.Data["Title"] = ctx.Tr("repo.wiki") + ctx.HTML(http.StatusOK, tplWikiStart) + return + } + wikiRepo, entry := renderViewPage(ctx) defer func() { if wikiRepo != nil { |