From 27fa2b7c1b32b1a9e826458b140e05b09d8387ee Mon Sep 17 00:00:00 2001 From: Norbert Biczo Date: Tue, 31 Aug 2021 19:51:41 +0200 Subject: [PATCH 1/2] fix: handle the error during gzip compression instead of panic --- v5/core/gzip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v5/core/gzip.go b/v5/core/gzip.go index 9121129..a6ac6bb 100644 --- a/v5/core/gzip.go +++ b/v5/core/gzip.go @@ -41,7 +41,7 @@ func NewGzipCompressionReader(uncompressedReader io.Reader) (io.Reader, error) { // to the pipe only when the pipe reader is called to retrieve more bytes. _, err := io.Copy(compressedWriter, uncompressedReader) if err != nil { - panic(err) + pipeWriter.CloseWithError(err) } }() return pipeReader, nil From db31813db3abf3fd86b7ffa237c5db1b234f6eba Mon Sep 17 00:00:00 2001 From: Norbert Biczo Date: Tue, 31 Aug 2021 20:04:21 +0200 Subject: [PATCH 2/2] chore: discard return value to make the linter happy --- v5/core/gzip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v5/core/gzip.go b/v5/core/gzip.go index a6ac6bb..1a83473 100644 --- a/v5/core/gzip.go +++ b/v5/core/gzip.go @@ -41,7 +41,7 @@ func NewGzipCompressionReader(uncompressedReader io.Reader) (io.Reader, error) { // to the pipe only when the pipe reader is called to retrieve more bytes. _, err := io.Copy(compressedWriter, uncompressedReader) if err != nil { - pipeWriter.CloseWithError(err) + _ = pipeWriter.CloseWithError(err) } }() return pipeReader, nil