case insensitive indexing

This commit is contained in:
Pierre Dubouilh
2020-01-18 16:33:10 +01:00
parent b2e0396cf1
commit be39e6aca8
+2
View File
@@ -14,6 +14,7 @@ import (
"net/url"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
)
@@ -79,6 +80,7 @@ func humanize(bytes int64) string {
func replyList(w http.ResponseWriter, fullPath string, path string) {
_files, err := ioutil.ReadDir(fullPath)
check(err)
sort.Slice(_files, func(i, j int) bool { return strings.ToLower(_files[i].Name()) < strings.ToLower(_files[j].Name()) })
if !strings.HasSuffix(path, "/") {
path += "/"