@@ -557,7 +557,12 @@ func Wiki(ctx *context.Context) {
557557 return
558558 }
559559
560- if ! ctx .Repo .Repository .HasWiki () {
560+ hasWiki , err := gitrepo .IsWikiRepositoryExist (ctx , ctx .Repo .Repository )
561+ if err != nil {
562+ ctx .ServerError ("IsWikiRepositoryExist" , err )
563+ return
564+ }
565+ if ! hasWiki {
561566 ctx .Data ["Title" ] = ctx .Tr ("repo.wiki" )
562567 ctx .HTML (http .StatusOK , tplWikiStart )
563568 return
@@ -598,7 +603,12 @@ func Wiki(ctx *context.Context) {
598603func WikiRevision (ctx * context.Context ) {
599604 ctx .Data ["CanWriteWiki" ] = ctx .Repo .CanWrite (unit .TypeWiki ) && ! ctx .Repo .Repository .IsArchived
600605
601- if ! ctx .Repo .Repository .HasWiki () {
606+ hasWiki , err := gitrepo .IsWikiRepositoryExist (ctx , ctx .Repo .Repository )
607+ if err != nil {
608+ ctx .ServerError ("IsWikiRepositoryExist" , err )
609+ return
610+ }
611+ if ! hasWiki {
602612 ctx .Data ["Title" ] = ctx .Tr ("repo.wiki" )
603613 ctx .HTML (http .StatusOK , tplWikiStart )
604614 return
@@ -634,7 +644,12 @@ func WikiRevision(ctx *context.Context) {
634644
635645// WikiPages render wiki pages list page
636646func WikiPages (ctx * context.Context ) {
637- if ! ctx .Repo .Repository .HasWiki () {
647+ hasWiki , err := gitrepo .IsWikiRepositoryExist (ctx , ctx .Repo .Repository )
648+ if err != nil {
649+ ctx .ServerError ("IsWikiRepositoryExist" , err )
650+ return
651+ }
652+ if ! hasWiki {
638653 ctx .Redirect (ctx .Repo .RepoLink + "/wiki" )
639654 return
640655 }
@@ -753,7 +768,12 @@ func WikiRaw(ctx *context.Context) {
753768func NewWiki (ctx * context.Context ) {
754769 ctx .Data ["Title" ] = ctx .Tr ("repo.wiki.new_page" )
755770
756- if ! ctx .Repo .Repository .HasWiki () {
771+ hasWiki , err := gitrepo .IsWikiRepositoryExist (ctx , ctx .Repo .Repository )
772+ if err != nil {
773+ ctx .ServerError ("IsWikiRepositoryExist" , err )
774+ return
775+ }
776+ if ! hasWiki {
757777 ctx .Data ["title" ] = "Home"
758778 }
759779 if ctx .FormString ("title" ) != "" {
@@ -806,7 +826,12 @@ func NewWikiPost(ctx *context.Context) {
806826func EditWiki (ctx * context.Context ) {
807827 ctx .Data ["PageIsWikiEdit" ] = true
808828
809- if ! ctx .Repo .Repository .HasWiki () {
829+ hasWiki , err := gitrepo .IsWikiRepositoryExist (ctx , ctx .Repo .Repository )
830+ if err != nil {
831+ ctx .ServerError ("IsWikiRepositoryExist" , err )
832+ return
833+ }
834+ if ! hasWiki {
810835 ctx .Redirect (ctx .Repo .RepoLink + "/wiki" )
811836 return
812837 }
0 commit comments