summaryrefslogtreecommitdiffstats
path: root/routers/routes
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-02-12 15:09:43 +0000
committerGitHub <noreply@github.com>2019-02-12 15:09:43 +0000
commit2a03e96bceadfcc5e18bd61e755980ee72dcdb15 (patch)
tree2ecc1848c76fe458f10dffe568a8bb0cdc0f32ee /routers/routes
parent296814e887f9bcf0b1d44552deaf40e89e08ab50 (diff)
downloadgitea-2a03e96bceadfcc5e18bd61e755980ee72dcdb15.tar.gz
gitea-2a03e96bceadfcc5e18bd61e755980ee72dcdb15.zip
Allow markdown files to read from the LFS (#5787)
This PR makes it possible for the markdown renderer to render images and media straight from the LFS. Fix #5746 Signed-off-by: Andrew Thornton [art27@cantab.net](mailto:art27@cantab.net)
Diffstat (limited to 'routers/routes')
-rw-r--r--routers/routes/routes.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 58274626c0..8ab7ff9bea 100644
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -731,6 +731,15 @@ func RegisterRoutes(m *macaron.Macaron) {
})
}, repo.MustAllowPulls)
+ m.Group("/media", func() {
+ m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.SingleDownloadOrLFS)
+ m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.SingleDownloadOrLFS)
+ m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.SingleDownloadOrLFS)
+ m.Get("/blob/:sha", context.RepoRefByType(context.RepoRefBlob), repo.DownloadByIDOrLFS)
+ // "/*" route is deprecated, and kept for backward compatibility
+ m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.SingleDownloadOrLFS)
+ }, repo.MustBeNotEmpty, reqRepoCodeReader)
+
m.Group("/raw", func() {
m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.SingleDownload)
m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.SingleDownload)