diff --git a/pkg/catalog/disk/find.go b/pkg/catalog/disk/find.go index 547564573d..de9a12cbc2 100644 --- a/pkg/catalog/disk/find.go +++ b/pkg/catalog/disk/find.go @@ -217,6 +217,7 @@ func (c *DiskCatalog) findGlobPathMatches(absPath string, processed map[string]s func (c *DiskCatalog) findFileMatches(absPath string, processed map[string]struct{}) (match string, matched bool, err error) { if c.templatesFS != nil { absPath = strings.TrimPrefix(absPath, "/") + absPath = strings.TrimSuffix(absPath, "/") } var info fs.File if c.templatesFS == nil { @@ -272,6 +273,7 @@ func (c *DiskCatalog) findDirectoryMatches(absPath string, processed map[string] if absPath == "" { absPath = "." } + absPath = strings.TrimSuffix(absPath, "/") err = fs.WalkDir( c.templatesFS, diff --git a/pkg/catalog/disk/path.go b/pkg/catalog/disk/path.go index e54ca59764..5c4b6dbb95 100644 --- a/pkg/catalog/disk/path.go +++ b/pkg/catalog/disk/path.go @@ -63,8 +63,7 @@ func (c *DiskCatalog) tryResolve(fullPath string) (string, error) { return fullPath, nil } } else { - _, err := fs.Stat(c.templatesFS, fullPath) - if err == nil { + if _, err := fs.Stat(c.templatesFS, fullPath); err == nil { return fullPath, nil } } diff --git a/pkg/types/types.go b/pkg/types/types.go index 2411e7f626..0dc5492a40 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -539,7 +539,8 @@ func (options *Options) ParseHeadlessOptionalArguments() map[string]string { func (options *Options) LoadHelperFile(helperFile, templatePath string, catalog catalog.Catalog) (io.ReadCloser, error) { if !options.AllowLocalFileAccess { // if global file access is disabled try loading with restrictions - absPath, err := catalog.ResolvePath(helperFile, templatePath) + //absPath, err := options.GetValidAbsPath(helperFile, templatePath) // ORIGINAL + absPath, err := catalog.ResolvePath(helperFile, templatePath) // PROPOSED CHANGE (USE THE CATALOG) if err != nil { return nil, err }