From 5dcfca5f7490194ea128e4df3adb60549a2d10ee Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Fri, 4 Dec 2015 00:19:33 -0500 Subject: [PATCH] Order matters no. 2 --- display.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/display.go b/display.go index 4591522..45727c8 100644 --- a/display.go +++ b/display.go @@ -86,16 +86,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) { tpl = Templates["display/story.html"] } } - } else if strings.HasPrefix(metadata.Mimetype, "text/") || supportedBinExtension(extension) { - if metadata.Size < maxDisplayFileSizeBytes { - bytes, err := ioutil.ReadFile(filePath) - if err == nil { - extra["extension"] = extension - extra["lang_hl"], extra["lang_ace"] = extensionToHlAndAceLangs(extension) - extra["contents"] = string(bytes) - tpl = Templates["display/bin.html"] - } - } + } else if extension == "md" { if metadata.Size < maxDisplayFileSizeBytes { bytes, err := ioutil.ReadFile(filePath) @@ -107,6 +98,17 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) { tpl = Templates["display/md.html"] } } + + } else if strings.HasPrefix(metadata.Mimetype, "text/") || supportedBinExtension(extension) { + if metadata.Size < maxDisplayFileSizeBytes { + bytes, err := ioutil.ReadFile(filePath) + if err == nil { + extra["extension"] = extension + extra["lang_hl"], extra["lang_ace"] = extensionToHlAndAceLangs(extension) + extra["contents"] = string(bytes) + tpl = Templates["display/bin.html"] + } + } } // Catch other files