Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match collector_binaries_accesslist case insensitive on windows and MacOS #467

Merged
merged 4 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/issue-364.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type = "fixed"
message = "Match collector_binaries_accesslist case insensitive on Windows and MacOS."

issues = ["364"]
pulls = ["467"]

1 change: 0 additions & 1 deletion dist/go.mod

This file was deleted.

9 changes: 8 additions & 1 deletion helpers/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ func PathMatch(path string, patternList []string) (PathMatchResult, error) {
}

for _, pattern := range patternList {
match, err := filepath.Match(pattern, result.Path)
var match bool
var err error
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
// ignore case on windows and MacOS. Both have usually case-insensitive filesystems.
match, err = filepath.Match(strings.ToLower(pattern), strings.ToLower(result.Path))
} else {
match, err = filepath.Match(pattern, result.Path)
}
if err != nil {
result.Match = false
return result, err
Expand Down