Apply logic to ignore invalid extensions for non glob matches

This commit is contained in:
Max Claus Nunes 2019-01-19 17:26:51 -02:00
parent 56a75324ca
commit 69ab70821a
1 changed files with 6 additions and 5 deletions

View File

@ -189,13 +189,14 @@ func resolvePaths(paths []string, extensions map[string]bool) (map[string]bool,
} }
for _, match := range matches { for _, match := range matches {
// don't care for extension filter right now for non glob paths // ignore existing files that don't match the allowed extensions
// since they could be a directory if f, err := os.Stat(match); !os.IsNotExist(err) && !f.IsDir() {
if isGlob { if ext := filepath.Ext(match); ext != "" {
if _, ok := extensions[filepath.Ext(match)]; !ok { if _, ok := extensions[ext]; !ok {
continue continue
} }
} }
}
if _, ok := result[match]; !ok { if _, ok := result[match]; !ok {
result[match] = true result[match] = true