handlers: a directory under /s/ answers 404, not a listing (closes #286)
check / check (push) Canceled after 0s

http.FileServer answered /s/ and /s/css/ with an HTML listing of the
embedded files, and /s/css with a redirect to that listing. HandleStatic
in internal/handlers now looks the name up in the embedded files first
and answers 404 when it names a directory; files are served as before.
The routes mount it under /s.

Model: opus-5-5
This commit was merged in pull request #293.
This commit is contained in:
2026-10-15 17:01:52 +02:00
parent caa3aa3c12
commit db3b09c5d8
5 changed files with 80 additions and 9 deletions
+1 -9
View File
@@ -8,8 +8,6 @@ import (
"github.com/go-chi/chi/v5"
chimw "github.com/go-chi/chi/v5/middleware"
"github.com/prometheus/client_golang/prometheus/promhttp"
"sneak.berlin/go/dnswatcher/static"
)
// requestTimeout is the maximum duration for handling a request.
@@ -47,13 +45,7 @@ func (s *Server) SetupRoutes() {
public.Get("/", s.handlers.HandleDashboard())
// Static assets (embedded CSS/JS)
public.Mount(
"/s",
http.StripPrefix(
"/s",
http.FileServer(http.FS(static.Static)),
),
)
public.Mount("/s", http.StripPrefix("/s", s.handlers.HandleStatic()))
// Health check (standard well-known path)
public.Get(