diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/vfs/serving/serving.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/vfs/serving/serving.go b/internal/vfs/serving/serving.go index 6f45e1d5..8f86d476 100644 --- a/internal/vfs/serving/serving.go +++ b/internal/vfs/serving/serving.go @@ -47,10 +47,16 @@ func serveContent(w http.ResponseWriter, r *http.Request, modtime time.Time, con return } - w.WriteHeader(code) + if r.Method == http.MethodHead { + w.WriteHeader(code) + } if r.Method != http.MethodHead { - io.Copy(w, content) + if _, err := io.Copy(w, content); err != nil { + errortracking.Capture(err, errortracking.WithRequest(r), errortracking.WithStackTrace()) + logging.LogRequest(r).WithError(err).Error("error serving content") + httperrors.Serve500(w) + } } } |