mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Backport #18587 It appears that the blob-excerpt links do not work on the wiki - likely since their introduction. This PR adds support for the wiki on these links. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@@ -952,7 +953,25 @@ func RegisterRoutes(m *web.Route) {
|
||||
|
||||
m.Group("/blob_excerpt", func() {
|
||||
m.Get("/{sha}", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ExcerptBlob)
|
||||
}, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader)
|
||||
}, func(ctx *context.Context) (cancel gocontext.CancelFunc) {
|
||||
if ctx.FormBool("wiki") {
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
repo.MustEnableWiki(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
reqRepoCodeReader(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
cancel = context.RepoRef()(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
||||
repo.MustBeNotEmpty(ctx)
|
||||
return
|
||||
})
|
||||
|
||||
m.Group("/pulls/{index}", func() {
|
||||
m.Get(".diff", repo.DownloadPullDiff)
|
||||
|
Reference in New Issue
Block a user