diff --git a/pkg/index/index.go b/pkg/index/index.go index 43769270a..eb93d4046 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -239,10 +239,11 @@ func (idx *Index) WriteArchiveIndex(ctx context.Context, destinationFile string) if err != nil { return fmt.Errorf("failed to create archive file: %w", err) } - defer outFile.Close() + if _, err = io.Copy(outFile, archive); err != nil { return fmt.Errorf("failed to write contents to archive file: %w", err) } + outFile.Close() if idx.SigningKey != "" { log.Infof("signing apk index at %s", idx.IndexFile)