Update rules/rules.go
Use `strings.HasPrefix` to avoid panic on empty string. Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
This commit is contained in:
parent
0aa85e09f0
commit
324113a0fe
@ -22,7 +22,7 @@ type Rule struct {
|
|||||||
// MatchHidden matches paths with a basename
|
// MatchHidden matches paths with a basename
|
||||||
// that begins with a dot.
|
// that begins with a dot.
|
||||||
func MatchHidden(path string) bool {
|
func MatchHidden(path string) bool {
|
||||||
return filepath.Base(path)[0] == '.'
|
return strings.HasPrefix(filepath.Base(path), ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches matches a path against a rule.
|
// Matches matches a path against a rule.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user