| skipped 7 lines |
8 | 8 | | "github.com/pkg/errors" |
9 | 9 | | ) |
10 | 10 | | |
11 | | - | // ResolvePath resolves the path to an absolute one in various ways. |
12 | | - | // |
13 | | - | // It checks if the filename is an absolute path, looks in the current directory |
14 | | - | // or checking the nuclei pocs directory. If a second path is given, |
15 | | - | // it also tries to find paths relative to that second path. |
16 | 11 | | func (c *Catalog) ResolvePath(pocName, second string) (string, error) { |
17 | 12 | | if filepath.IsAbs(pocName) { |
18 | 13 | | return pocName, nil |
| skipped 11 lines |
30 | 25 | | } |
31 | 26 | | |
32 | 27 | | pocPath := filepath.Join(curDirectory, pocName) |
33 | | - | if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination { |
34 | | - | return potentialPath, nil |
| 28 | + | if len(pocPath) > 0 { |
| 29 | + | return pocPath, nil |
35 | 30 | | } |
| 31 | + | // if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination { |
| 32 | + | // return potentialPath, nil |
| 33 | + | // } |
36 | 34 | | |
37 | 35 | | if c.pocsDirectory != "" { |
38 | 36 | | pocPath := filepath.Join(c.pocsDirectory, pocName) |
39 | | - | if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination { |
40 | | - | return potentialPath, nil |
| 37 | + | if len(pocPath) > 0 { |
| 38 | + | return pocPath, nil |
41 | 39 | | } |
| 40 | + | // if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination { |
| 41 | + | // return potentialPath, nil |
| 42 | + | // } |
42 | 43 | | } |
43 | 44 | | return "", fmt.Errorf("no such path found: %s", pocName) |
44 | 45 | | } |
| skipped 24 lines |