commit
This commit is contained in:
parent
b5063758e5
commit
d0769b2cb3
@ -100,7 +100,12 @@ func dirList(w http.ResponseWriter, r *http.Request, f http.File, name string) {
|
|||||||
renderError(w, "Error reading directory", http.StatusInternalServerError)
|
renderError(w, "Error reading directory", http.StatusInternalServerError)
|
||||||
return
|
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")
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
|
|
||||||
@ -112,6 +117,7 @@ func dirList(w http.ResponseWriter, r *http.Request, f http.File, name string) {
|
|||||||
|
|
||||||
data := &Data{
|
data := &Data{
|
||||||
Title: name,
|
Title: name,
|
||||||
|
IsRoot: name == "/",
|
||||||
Files: make([]*File, 0, len(dirs)),
|
Files: make([]*File, 0, len(dirs)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user