Big ol' gofmt.
This commit is contained in:
parent
56d8dde14a
commit
5258b29c6b
|
@ -2,11 +2,11 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/BurntSushi/toml"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
@ -93,7 +93,7 @@ func getConfig(filename string) (Config, error) {
|
|||
}
|
||||
|
||||
// Absolutise DocBase
|
||||
if(!filepath.IsAbs(config.DocBase)) {
|
||||
if !filepath.IsAbs(config.DocBase) {
|
||||
abs, err := filepath.Abs(config.DocBase)
|
||||
if err != nil {
|
||||
return config, err
|
||||
|
@ -103,7 +103,7 @@ func getConfig(filename string) (Config, error) {
|
|||
|
||||
// Absolutise CGI paths
|
||||
for index, cgiPath := range config.CGIPaths {
|
||||
if(!filepath.IsAbs(cgiPath)) {
|
||||
if !filepath.IsAbs(cgiPath) {
|
||||
config.CGIPaths[index] = filepath.Join(config.DocBase, cgiPath)
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func getConfig(filename string) (Config, error) {
|
|||
|
||||
// Absolutise SCGI paths
|
||||
for index, scgiPath := range config.SCGIPaths {
|
||||
if(!filepath.IsAbs(scgiPath)) {
|
||||
if !filepath.IsAbs(scgiPath) {
|
||||
config.SCGIPaths[index] = filepath.Join(config.DocBase, scgiPath)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ func generateDirectoryListing(URL *url.URL, path string, config Config) (string,
|
|||
return false // Should not happen
|
||||
})
|
||||
// Sort directories before file
|
||||
if(config.DirectorySubdirsFirst) {
|
||||
if config.DirectorySubdirsFirst {
|
||||
sort.SliceStable(files, func(i, j int) bool {
|
||||
// If i is a dir and j is a file, i < j
|
||||
if files[i].IsDir() && !files[j].IsDir() {
|
||||
|
|
|
@ -262,11 +262,11 @@ func serveFile(path string, log *LogEntry, conn net.Conn, config Config, errorLo
|
|||
mimeType = "application/octet-stream"
|
||||
}
|
||||
// Add charset parameter
|
||||
if strings.HasPrefix(mimeType,"text/gemini") && config.DefaultEncoding != "" {
|
||||
if strings.HasPrefix(mimeType, "text/gemini") && config.DefaultEncoding != "" {
|
||||
mimeType += "; charset=" + config.DefaultEncoding
|
||||
}
|
||||
// Add lang parameter
|
||||
if strings.HasPrefix(mimeType,"text/gemini") && config.DefaultLang != "" {
|
||||
if strings.HasPrefix(mimeType, "text/gemini") && config.DefaultLang != "" {
|
||||
mimeType += "; lang=" + config.DefaultLang
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue