Skip to content

Commit ecbc7b9

Browse files
authored
fix: plan filename search (#172)
* When github action uploads files it includes relative path. To match that we can just match the name of the file instead of the whole path, given that project names are unique. Which they should be
1 parent c6e4d2b commit ecbc7b9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/configuration/digger_config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ func ConvertDiggerYamlToConfig(diggerYaml *DiggerConfigYaml, workingDir string,
199199
}
200200
}
201201

202+
projectNames := make(map[string]bool)
203+
204+
for _, project := range diggerConfig.Projects {
205+
if projectNames[project.Name] {
206+
return nil, fmt.Errorf("project name '%s' is duplicated", project.Name)
207+
}
208+
projectNames[project.Name] = true
209+
}
210+
202211
return &diggerConfig, nil
203212
}
204213

pkg/utils/io.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"bytes"
66
"io"
77
"io/ioutil"
8+
"strings"
89
)
910

1011
type Zip interface {
@@ -20,12 +21,12 @@ func (z *Zipper) GetFileFromZip(zipFile string, filename string) (string, error)
2021
return "", err
2122
}
2223
defer reader.Close()
23-
2424
for _, file := range reader.File {
2525
if file.FileInfo().IsDir() {
2626
continue
2727
}
28-
if file.Name == filename {
28+
29+
if strings.HasSuffix(file.Name, filename) {
2930
rc, err := file.Open()
3031
if err != nil {
3132
return "", err

0 commit comments

Comments
 (0)