mirror of
https://github.com/ZizzyDizzyMC/linx-server.git
synced 2026-01-23 10:16:37 +00:00
Order matters no. 2
This commit is contained in:
parent
7c1a4640db
commit
5dcfca5f74
1 changed files with 12 additions and 10 deletions
22
display.go
22
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue