fix(dashboard): serve embedded pages via io.ReadSeeker (fixes 500 on /fleet)
Some checks failed
CI Benchmark - Fusion Loop Timing / Fusion Loop Timing Benchmark (push) Has been cancelled

serveEmbeddedFile asserted the embedded file implemented
`interface { Len() int64; io.ReadSeeker }`, but *embed.openFile has no
Len() method, so http.ServeContent panicked (caught by chi Recoverer ->
500) on every embedded page: /fleet, /ambient, /live, /setup, /simple, /.
http.ServeContent only needs an io.ReadSeeker, which embed files satisfy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-26 20:43:30 -04:00
parent 9277217865
commit 9ac200b719
2 changed files with 7 additions and 5 deletions

View file

@ -1 +1 @@
0.1.352
0.1.353

View file

@ -311,10 +311,12 @@ func serveEmbeddedFile(w http.ResponseWriter, r *http.Request, filename string)
http.NotFound(w, r)
return
}
http.ServeContent(w, r, filename, stat.ModTime(), file.(interface {
Len() int64
io.ReadSeeker
}))
rs, ok := file.(io.ReadSeeker)
if !ok {
http.NotFound(w, r)
return
}
http.ServeContent(w, r, filename, stat.ModTime(), rs)
return
}