Skip to content

Commit aa79738

Browse files
authored
Fix the bug: no wiki page can be created if the repo didn't have any page yet. (#17894)
1 parent 1a78e23 commit aa79738

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

routers/web/repo/wiki.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,6 @@ func Wiki(ctx *context.Context) {
409409
ctx.Data["PageIsWiki"] = true
410410
ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived
411411

412-
if !ctx.Repo.Repository.HasWiki() {
413-
ctx.Data["Title"] = ctx.Tr("repo.wiki")
414-
ctx.HTML(http.StatusOK, tplWikiStart)
415-
return
416-
}
417-
418412
switch ctx.FormString("action") {
419413
case "_pages":
420414
WikiPages(ctx)
@@ -438,6 +432,12 @@ func Wiki(ctx *context.Context) {
438432
return
439433
}
440434

435+
if !ctx.Repo.Repository.HasWiki() {
436+
ctx.Data["Title"] = ctx.Tr("repo.wiki")
437+
ctx.HTML(http.StatusOK, tplWikiStart)
438+
return
439+
}
440+
441441
wikiRepo, entry := renderViewPage(ctx)
442442
defer func() {
443443
if wikiRepo != nil {

0 commit comments

Comments
 (0)