Browse Source

Fix out of bounds error

pull/73/head v1.1.5
andreimarcu 9 years ago
parent
commit
10d30df81f
  1. 2
      display.go

2
display.go

@ -77,7 +77,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) {
} else if metadata.Mimetype == "application/pdf" { } else if metadata.Mimetype == "application/pdf" {
tpl = Templates["display/pdf.html"] 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 { if metadata.Size < maxDisplayFileSizeBytes {
bytes, err := ioutil.ReadFile(filePath) bytes, err := ioutil.ReadFile(filePath)
if err == nil { if err == nil {

Loading…
Cancel
Save