diff --git a/modules/markup/markdown/markdown.go b/modules/markup/markdown/markdown.go index 5bf26d562de43..1525ba7812240 100644 --- a/modules/markup/markdown/markdown.go +++ b/modules/markup/markdown/markdown.go @@ -104,7 +104,7 @@ func (r *Renderer) ListItem(out *bytes.Buffer, text []byte, flags int) { func (r *Renderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { prefix := r.URLPrefix if r.IsWiki { - prefix = util.URLJoin(prefix, "wiki", "media") + prefix = util.URLJoin(prefix, "wiki", "raw") } prefix = strings.Replace(prefix, "/src/", "/media/", 1) if len(link) > 0 && !markup.IsLink(link) { diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index 0735318bd3fc8..8426406c31279 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -332,47 +332,6 @@ func WikiRaw(ctx *context.Context) { ctx.NotFound("findEntryForFile", nil) } -// WikiMedia outputs either the raw blob or its LFS blob as requested by the user (images for example) -func WikiMedia(ctx *context.Context) { - wikiRepo, commit, err := findWikiRepoCommit(ctx) - if err != nil { - if wikiRepo != nil { - return - } - } - - providedPath := ctx.Params("*") - - var entry *git.TreeEntry - if commit != nil { - entry, err = findEntryForFile(commit, providedPath) - if err != nil { - ctx.ServerError("findFile", err) - } - - if entry == nil { - // Try to find a wiki page with that name - if strings.HasSuffix(providedPath, ".md") { - providedPath = providedPath[:len(providedPath)-3] - } - - wikiPath := models.WikiNameToFilename(providedPath) - entry, err = findEntryForFile(commit, wikiPath) - if err != nil { - ctx.ServerError("findFile", err) - return - } - } - } - - if entry != nil { - if err = ServeBlobOrLFS(ctx, entry.Blob()); err != nil { - ctx.ServerError("ServeBlob", err) - } - } - ctx.NotFound("findEntryForFile", nil) -} - // NewWiki render wiki create page func NewWiki(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 8d99a23763aa4..8ab7ff9bea088 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -703,7 +703,6 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/wiki", func() { m.Get("/raw/*", repo.WikiRaw) - m.Get("/media/*", repo.WikiMedia) }, repo.MustEnableWiki) m.Group("/activity", func() {