@@ -55,11 +55,12 @@ func InitWiki(ctx context.Context, repo *repo_model.Repository) error {
5555// prepareGitPath try to find a suitable file path with file name by the given raw wiki name.
5656// return: existence, prepared file path with name, error
5757func prepareGitPath (gitRepo * git.Repository , defaultWikiBranch string , wikiPath WebPath ) (bool , string , error ) {
58- unescaped := string (wikiPath ) + ".md"
58+ unescapedMd := string (wikiPath ) + ".md"
59+ unescapedOrg := string (wikiPath ) + ".org"
5960 gitPath := WebPathToGitPath (wikiPath )
6061
61- // Look for both files
62- filesInIndex , err := gitRepo .LsTree (defaultWikiBranch , unescaped , gitPath )
62+ // Look for .md, .org, and escaped file
63+ filesInIndex , err := gitRepo .LsTree (defaultWikiBranch , unescapedMd , unescapedOrg , gitPath )
6364 if err != nil {
6465 if strings .Contains (err .Error (), "Not a valid object name" ) {
6566 return false , gitPath , nil // branch doesn't exist
@@ -71,9 +72,11 @@ func prepareGitPath(gitRepo *git.Repository, defaultWikiBranch string, wikiPath
7172 foundEscaped := false
7273 for _ , filename := range filesInIndex {
7374 switch filename {
74- case unescaped :
75- // if we find the unescaped file return it
76- return true , unescaped , nil
75+ // if we find unescaped file (.md or .org) return it
76+ case unescapedMd :
77+ return true , unescapedMd , nil
78+ case unescapedOrg :
79+ return true , unescapedOrg , nil
7780 case gitPath :
7881 foundEscaped = true
7982 }
0 commit comments