Skip to content

Commit

Permalink
Wrap up
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-threatmate committed Jul 20, 2024
1 parent 926577b commit 981f451
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/catalog/disk/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions pkg/catalog/disk/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 981f451

Please sign in to comment.