commit
This commit is contained in:
parent
b5063758e5
commit
d0769b2cb3
12
handler.go
12
handler.go
@ -100,7 +100,12 @@ func dirList(w http.ResponseWriter, r *http.Request, f http.File, name string) {
|
||||
renderError(w, "Error reading directory", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
sort.Slice(dirs, func(i, j int) bool { return dirs[i].Name() < dirs[j].Name() })
|
||||
sort.Slice(dirs, func(i, j int) bool {
|
||||
if dirs[i].IsDir() && !dirs[j].IsDir() {
|
||||
return true
|
||||
}
|
||||
return dirs[i].Name() < dirs[j].Name()
|
||||
})
|
||||
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
|
||||
@ -111,8 +116,9 @@ func dirList(w http.ResponseWriter, r *http.Request, f http.File, name string) {
|
||||
}
|
||||
|
||||
data := &Data{
|
||||
Title: name,
|
||||
Files: make([]*File, 0, len(dirs)),
|
||||
Title: name,
|
||||
IsRoot: name == "/",
|
||||
Files: make([]*File, 0, len(dirs)),
|
||||
}
|
||||
|
||||
for _, d := range dirs {
|
||||
|
Loading…
x
Reference in New Issue
Block a user