Skip to content

Commit

Permalink
Remove wiki media pathways as they need more thought
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Feb 7, 2019
1 parent 8b224e8 commit 0e26b72
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
2 changes: 1 addition & 1 deletion modules/markup/markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
41 changes: 0 additions & 41 deletions routers/repo/wiki.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion routers/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0e26b72

Please sign in to comment.