Skip to content

Commit

Permalink
fix: clean paths after reading config
Browse files Browse the repository at this point in the history
Signed-off-by: German Lashevich <[email protected]>
  • Loading branch information
Zebradil committed Dec 24, 2023
1 parent 217399e commit 80a2003
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/vendir/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"reflect"
"strings"

"carvel.dev/vendir/pkg/vendir/version"
semver "github.com/hashicorp/go-version"
"sigs.k8s.io/yaml"

"carvel.dev/vendir/pkg/vendir/version"
)

const (
Expand Down Expand Up @@ -69,6 +70,7 @@ func NewConfigFromFiles(paths []string) (Config, []Secret, []ConfigMap, error) {

case res.APIVersion == knownAPIVersion && res.Kind == knownKind:
config, err := NewConfigFromBytes(docBytes)
config.cleanPaths()
if err != nil {
return fmt.Errorf("Unmarshaling config: %s", err)
}
Expand Down Expand Up @@ -278,3 +280,12 @@ func (c Config) checkOverlappingPaths() error {

return nil
}

func (c *Config) cleanPaths() {
for i, dir := range c.Directories {
c.Directories[i].Path = filepath.Clean(dir.Path)
for j, con := range dir.Contents {
c.Directories[i].Contents[j].Path = filepath.Clean(con.Path)
}
}
}

0 comments on commit 80a2003

Please sign in to comment.