From ac76e5e70697aea6548fe24195a7bdf113093671 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:38:50 +0000 Subject: [PATCH] Update submit.go Refactor slightly to be clearer that we only add .gz if it's not already there. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --- submit.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/submit.go b/submit.go index e457b30..9b5d3c8 100644 --- a/submit.go +++ b/submit.go @@ -438,10 +438,9 @@ func saveLogPart(logNum int, filename string, reader io.Reader, reportDir string // Either way, we need to append .gz, because we're compressing it. var leafName string if logRegexp.MatchString(filename) { - if strings.HasSuffix(filename, ".gz") { - leafName = filename - } else { - leafName = filename + ".gz" + leafName = filename + if !strings.HasSuffix(filename, ".gz") { + leafName += ".gz" } } else { leafName = fmt.Sprintf("logs-%04d.log.gz", logNum)