chore: log addToZip errors instead of silently dropping
This commit is contained in:
parent
be3aa7a036
commit
8759b31e47
1 changed files with 8 additions and 2 deletions
|
|
@ -482,13 +482,19 @@ func (h *FileHandler) StartDownloadCleanup() {
|
||||||
// Internal helpers
|
// 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) {
|
func addToZip(zw *zip.Writer, name string, data []byte) {
|
||||||
f, err := zw.Create(name)
|
f, err := zw.Create(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("WARN [%s] handlers: addToZip: create %q: %v",
|
||||||
|
time.Now().Format(time.RFC3339), name, err)
|
||||||
return
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue