Fix out of bounds error

This commit is contained in:
andreimarcu 2015-11-12 01:04:05 -05:00
parent 9cf55ac687
commit 10d30df81f

View File

@ -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 {