From 10d30df81f934bc7d9c28c5984f28b1b78be2033 Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Thu, 12 Nov 2015 01:04:05 -0500 Subject: [PATCH] Fix out of bounds error --- display.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display.go b/display.go index 4306ddc..6678550 100644 --- a/display.go +++ b/display.go @@ -77,7 +77,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) { } else if metadata.Mimetype == "application/pdf" { tpl = Templates["display/pdf.html"] - } else if metadata.Mimetype[:5] == "text/" || supportedBinExtension(extension) { + } else if strings.HasPrefix(metadata.Mimetype, "text/") || supportedBinExtension(extension) { if metadata.Size < maxDisplayFileSizeBytes { bytes, err := ioutil.ReadFile(filePath) if err == nil {