Ensure path is resolved before using it

This commit is contained in:
Manuel Bua 2020-07-19 14:04:49 +02:00
parent 97069afb3c
commit 0983e8b9fa

View File

@ -124,20 +124,20 @@ func (r *Runner) RunEnumeration() {
// parses user input, handle file/directory cases and produce a list of unique templates // parses user input, handle file/directory cases and produce a list of unique templates
for _, t := range r.options.Templates { for _, t := range r.options.Templates {
// determine file/directory // resolve and convert relative to absolute path
isFile, err := isFilePath(t)
if err != nil {
gologger.Errorf("Could not stat '%s': %s\n", t, err)
continue
}
// convert relative to absolute path
absPath, err := r.translateToAbsolutePath(t) absPath, err := r.translateToAbsolutePath(t)
if err != nil { if err != nil {
gologger.Errorf("Could not find template file '%s': %s\n", t, err) gologger.Errorf("Could not find template file '%s': %s\n", t, err)
continue continue
} }
// determine file/directory
isFile, err := isFilePath(absPath)
if err != nil {
gologger.Errorf("Could not stat '%s': %s\n", absPath, err)
continue
}
// test for uniqueness // test for uniqueness
if !isNewPath(absPath, processed) { if !isNewPath(absPath, processed) {
continue continue