Skip to content

Commit 92585e5

Browse files
authored
Merge pull request #3935 from cpanato/fix
fix array size when creating the assets
2 parents e09fd70 + 68bfd0c commit 92585e5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cmd/publish-release/cmd/github.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,14 @@ func runGithubPage(opts *githubPageCmdLineOptions) (err error) {
308308
}
309309
}
310310

311-
newAssets := make([]string, len(assets)+1)
312-
for i, a := range assets {
313-
newAssets[i] = a.ReadFrom
311+
var newAssets []string //nolint: prealloc,gocritic
312+
for _, a := range assets {
313+
newAssets = append(newAssets, a.ReadFrom)
314314
}
315-
316315
// add sbom to the path to upload
317-
newAssets[len(assets)] = sbomStr
316+
if sbomStr != "" {
317+
newAssets = append(newAssets, sbomStr)
318+
}
318319

319320
// Build the release page options
320321
ghOpts := github.Options{

pkg/announce/github/impl.go

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ func (i *defaultImpl) github() *githubsdk.GitHub {
4949
func (i *defaultImpl) processAssetFiles(assetFiles []string) (releaseAssets []map[string]string, err error) {
5050
// Check all asset files and get their hashes
5151
for _, path := range assetFiles {
52+
if path == "" {
53+
continue
54+
}
55+
5256
assetData := map[string]string{
5357
"rawpath": path,
5458
"name": "",

0 commit comments

Comments
 (0)