diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-07 00:41:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-07 00:41:45 +0300 |
| commit | e98f0edb56f3d2355adf83a79edcc8ec2fa65a18 (patch) | |
| tree | 64c958a8d81633bbd92aaf39932ace60beeeca6a /internal/api/handlers.go | |
| parent | 2985cbc5d84d6841bed8a249308eeaeb70bb3c83 (diff) | |
Fix static file read seeker guard for s0
Diffstat (limited to 'internal/api/handlers.go')
| -rw-r--r-- | internal/api/handlers.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go index b837a18..9fcb780 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -100,7 +100,12 @@ func (s *Server) serveFile(w http.ResponseWriter, r *http.Request, filename stri http.Error(w, "not found", http.StatusNotFound) return } - http.ServeContent(w, r, filename, stat.ModTime(), f.(io.ReadSeeker)) + rs, ok := f.(io.ReadSeeker) + if !ok { + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + http.ServeContent(w, r, filename, stat.ModTime(), rs) } func (s *Server) serveIndex(w http.ResponseWriter, r *http.Request) { |
