From 8759b31e476d6b5e41b173927f6d7c5ad1a95916 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 17 Jun 2026 12:14:37 +0000 Subject: [PATCH] chore: log addToZip errors instead of silently dropping --- internal/handlers/file.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/handlers/file.go b/internal/handlers/file.go index df4cfc9..3b800e5 100644 --- a/internal/handlers/file.go +++ b/internal/handlers/file.go @@ -482,13 +482,19 @@ func (h *FileHandler) StartDownloadCleanup() { // Internal helpers // --------------------------------------------------------------------------- -// addToZip adds a file to a zip.Writer. +// addToZip adds a file to a zip.Writer. Errors are logged but not returned +// since a missing image in the ZIP is non-fatal — the report is the priority. func addToZip(zw *zip.Writer, name string, data []byte) { f, err := zw.Create(name) if err != nil { + log.Printf("WARN [%s] handlers: addToZip: create %q: %v", + time.Now().Format(time.RFC3339), name, err) return } - f.Write(data) + if _, err := f.Write(data); err != nil { + log.Printf("WARN [%s] handlers: addToZip: write %q: %v", + time.Now().Format(time.RFC3339), name, err) + } } // ---------------------------------------------------------------------------