From 1ac8caa0e2463a2b523a3631bbd6029f2a030759 Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Mon, 9 Dec 2024 19:08:52 -0500 Subject: [PATCH] fix multi-value context --- internal/agent/cache/exclusions.go | 6 +++++- internal/agent/cache/partial_files.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/agent/cache/exclusions.go b/internal/agent/cache/exclusions.go index cd1bac3..2ef2533 100644 --- a/internal/agent/cache/exclusions.go +++ b/internal/agent/cache/exclusions.go @@ -45,7 +45,11 @@ func CompileExcludedPaths() []*regexp.Regexp { // Compile excluded patterns for _, pattern := range excludedPatterns { - compiledRegexes = append(compiledRegexes, regexp.MustCompile("(?i)"+utils.GlobToRegex(pattern))) + rexp, err := utils.GlobToRegex(pattern) + if err != nil { + continue + } + compiledRegexes = append(compiledRegexes, regexp.MustCompile("(?i)"+rexp)) } return compiledRegexes diff --git a/internal/agent/cache/partial_files.go b/internal/agent/cache/partial_files.go index f37b54f..542caa7 100644 --- a/internal/agent/cache/partial_files.go +++ b/internal/agent/cache/partial_files.go @@ -47,7 +47,11 @@ func CompilePartialFileList() []*regexp.Regexp { // Compile excluded patterns for _, pattern := range partialPatterns { - compiledRegexes = append(compiledRegexes, regexp.MustCompile("(?i)^"+utils.GlobToRegex(pattern))) + rexp, err := utils.GlobToRegex(pattern) + if err != nil { + continue + } + compiledRegexes = append(compiledRegexes, regexp.MustCompile("(?i)"+rexp)) } return compiledRegexes