bruschetta

A simple golang web based file browser
Log | Files | Refs | LICENSE

commit 23effb4ba3fa7f12c2938d94242d80037f8d397b
parent 452d752186ad464186d245a4ffacbd92729f680f
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Tue,  4 Aug 2026 10:15:43 +0100

Render index.htm(l) files if they exist instead of directory listing

Diffstat:
Mmain.go | 8++++++++
Mreadme.md | 1+
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/main.go b/main.go @@ -413,6 +413,14 @@ func listingHandler(w http.ResponseWriter, r *http.Request) { return } + for _, indexName := range []string{"index.html", "index.htm"} { + indexPath := filepath.Join(fsPath, indexName) + if fi, err := os.Stat(indexPath); err == nil && !fi.IsDir() { + http.ServeFile(w, r, indexPath) + return + } + } + entries, err := os.ReadDir(fsPath) if err != nil { http.Error(w, "Cannot read directory", http.StatusInternalServerError) diff --git a/readme.md b/readme.md @@ -23,6 +23,7 @@ The application is also buildable via your usual `go build -o bruschetta .`. * Collapsable folder tree * Sortable Name, Size and Modified columns * No dependencies outside stdlib +* Renders `index.htm(l)` files in directories instead of listing ## Screenshot