Skip to content

Commit 9cdfd11

Browse files
greynewellclaude
andcommitted
fix(restore): propagate src.Close() error in copyFileIntoZip
If io.Copy succeeded but src.Close() failed, the close error was silently discarded. Preserve the intent of not using defer (to avoid accumulating open handles across Walk iterations) while returning the close error when no copy error occurred. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5927c28 commit 9cdfd11

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cmd/restore.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ func copyFileIntoZip(path string, w io.Writer) error {
245245
return err
246246
}
247247
_, err = io.Copy(w, src)
248-
src.Close()
248+
if closeErr := src.Close(); err == nil {
249+
err = closeErr
250+
}
249251
return err
250252
}
251253

0 commit comments

Comments
 (0)