marky

Lightweight bookmarking + plaintext archive
Log | Files | Refs | README | LICENSE

commit fae2f116a718bb1ac28f6b1bc5db05fabf283d27
parent bba73c3bc1d03c7cb008377ffa30b5214b32f696
Author: David Eisinger <[email protected]>
Date:   Mon, 20 Oct 2025 11:43:21 -0400

Fix broken test

Diffstat:
Minternal/static.go | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/internal/static.go b/internal/static.go @@ -28,6 +28,15 @@ func StaticHandlerWithConfig(cfg HandlerConfig) (http.Handler, error) { fileServer := http.FileServer(fsys) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { p := strings.TrimPrefix(r.URL.Path, "/") + // Root should serve the login page (index) + if p == "" { + if html, err := RenderPage("login.html", cfg); err == nil { + html = applyCacheBust(html) + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _, _ = w.Write(html) + return + } + } // Try to stat the requested file if f, err := fs.Stat(sub, path.Clean(p)); err == nil && !f.IsDir() { fileServer.ServeHTTP(w, r)