Skip to content

Commit 3931b8f

Browse files
author
Aly Sewelam
committed
Add .org file detection to WikiRaw function
1 parent 51b7680 commit 3931b8f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

routers/web/repo/wiki.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,15 @@ func WikiRaw(ctx *context.Context) {
669669
}
670670

671671
if entry == nil {
672-
// Try to find a wiki page with that name
673-
providedGitPath = strings.TrimSuffix(providedGitPath, ".md")
672+
// Try to find a wiki page with that name (check both .md and .org)
673+
providedGitPath := strings.TrimSuffix(providedGitPath, ".md")
674+
// Try .org version
675+
orgPath := providedGitPath + ".org"
676+
entry, err = findEntryForFile(commit, orgPath)
677+
if err != nil && !git.IsErrNotExist(err) {
678+
ctx.ServerError("findFile", err)
679+
return
680+
}
674681
entry, err = findEntryForFile(commit, providedGitPath)
675682
if err != nil && !git.IsErrNotExist(err) {
676683
ctx.ServerError("findFile", err)

0 commit comments

Comments
 (0)