mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix the bug: no wiki page can be created if the repo didn't have any page yet. (#17894)
This commit is contained in:
		@@ -409,12 +409,6 @@ func Wiki(ctx *context.Context) {
 | 
				
			|||||||
	ctx.Data["PageIsWiki"] = true
 | 
						ctx.Data["PageIsWiki"] = true
 | 
				
			||||||
	ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived
 | 
						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") {
 | 
						switch ctx.FormString("action") {
 | 
				
			||||||
	case "_pages":
 | 
						case "_pages":
 | 
				
			||||||
		WikiPages(ctx)
 | 
							WikiPages(ctx)
 | 
				
			||||||
@@ -438,6 +432,12 @@ func Wiki(ctx *context.Context) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !ctx.Repo.Repository.HasWiki() {
 | 
				
			||||||
 | 
							ctx.Data["Title"] = ctx.Tr("repo.wiki")
 | 
				
			||||||
 | 
							ctx.HTML(http.StatusOK, tplWikiStart)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wikiRepo, entry := renderViewPage(ctx)
 | 
						wikiRepo, entry := renderViewPage(ctx)
 | 
				
			||||||
	defer func() {
 | 
						defer func() {
 | 
				
			||||||
		if wikiRepo != nil {
 | 
							if wikiRepo != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user