Order matters!
This commit is contained in:
parent
88c00027ea
commit
7c1a4640db
18
display.go
18
display.go
|
@ -77,6 +77,15 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
} else if metadata.Mimetype == "application/pdf" {
|
||||
tpl = Templates["display/pdf.html"]
|
||||
|
||||
} else if extension == "story" {
|
||||
if metadata.Size < maxDisplayFileSizeBytes {
|
||||
bytes, err := ioutil.ReadFile(filePath)
|
||||
if err == nil {
|
||||
extra["contents"] = string(bytes)
|
||||
lines = strings.Split(extra["contents"], "\n")
|
||||
tpl = Templates["display/story.html"]
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(metadata.Mimetype, "text/") || supportedBinExtension(extension) {
|
||||
if metadata.Size < maxDisplayFileSizeBytes {
|
||||
bytes, err := ioutil.ReadFile(filePath)
|
||||
|
@ -87,15 +96,6 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
tpl = Templates["display/bin.html"]
|
||||
}
|
||||
}
|
||||
} else if extension == "story" {
|
||||
if metadata.Size < maxDisplayFileSizeBytes {
|
||||
bytes, err := ioutil.ReadFile(filePath)
|
||||
if err == nil {
|
||||
extra["contents"] = string(bytes)
|
||||
lines = strings.Split(extra["contents"], "\n")
|
||||
tpl = Templates["display/story.html"]
|
||||
}
|
||||
}
|
||||
} else if extension == "md" {
|
||||
if metadata.Size < maxDisplayFileSizeBytes {
|
||||
bytes, err := ioutil.ReadFile(filePath)
|
||||
|
|
Loading…
Reference in New Issue