Skip to content

Commit ff8a90a

Browse files
authored
Merge pull request #788 from abohoss/bug/abohoss/784-2
some error checks added (static checks)
2 parents be97e2a + f62add7 commit ff8a90a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

converter/tests/helm_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"archive/tar"
55
"bytes"
66
"compress/gzip"
7+
"fmt"
78
"io"
89
"os"
910
"strings"
@@ -139,7 +140,9 @@ func extractManifestFromChart(chartData []byte) (bool, string) {
139140
}
140141
if strings.HasSuffix(hdr.Name, "templates/manifest.yaml") {
141142
buf := new(bytes.Buffer)
142-
io.Copy(buf, tr)
143+
if _, err := io.Copy(buf, tr); err != nil {
144+
return false, fmt.Sprintf("failed to copy manifest content: %v", err)
145+
}
143146
return true, buf.String()
144147
}
145148
}

generators/github/url.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package github
33
import (
44
"bufio"
55
"io"
6-
6+
"fmt"
77
"net/url"
88
"os"
99
"path/filepath"
@@ -55,6 +55,9 @@ func (u URL) GetContent() (models.Package, error) {
5555
if strings.HasSuffix(url, ".yml") || strings.HasSuffix(url, ".yaml") {
5656

5757
data, err := os.ReadFile(downloadfilePath)
58+
if err != nil {
59+
return nil, fmt.Errorf("failed to read file %s: %w", downloadfilePath, err)
60+
}
5861
_, err = w.Write(data)
5962
if err != nil {
6063
return nil, err

0 commit comments

Comments
 (0)