From 67484100e1efec1bc1ed157ea797b2c03bfcba7b Mon Sep 17 00:00:00 2001 From: Lucas Pablo Calisi Date: Tue, 21 May 2024 21:40:18 -0300 Subject: [PATCH 1/2] fix(index): close file before sign Signed-off-by: Lucas Pablo Calisi --- pkg/index/index.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) From 78b731839d9c18742829c3d26a94eec456fef547 Mon Sep 17 00:00:00 2001 From: Lucas Pablo Calisi Date: Sat, 25 May 2024 12:29:22 -0300 Subject: [PATCH 2/2] chore: missing fmt Signed-off-by: Lucas Pablo Calisi --- pkg/index/index.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/index/index.go b/pkg/index/index.go index eb93d4046..78ba0f6b0 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -243,7 +243,7 @@ func (idx *Index) WriteArchiveIndex(ctx context.Context, destinationFile string) if _, err = io.Copy(outFile, archive); err != nil { return fmt.Errorf("failed to write contents to archive file: %w", err) } - outFile.Close() + outFile.Close() if idx.SigningKey != "" { log.Infof("signing apk index at %s", idx.IndexFile)