Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0da00072ef
commit
790ac92c7a
1 changed files with 6 additions and 1 deletions
|
|
@ -110,7 +110,12 @@ func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Conf
|
|||
if len(allowPatterns) > 0 {
|
||||
allowRegex = make([]*regexp.Regexp, 0, len(allowPatterns))
|
||||
for _, p := range allowPatterns {
|
||||
allowRegex = append(allowRegex, regexp.MustCompile(p))
|
||||
re, err := regexp.Compile(p)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "NewExecTool: invalid allow pattern %q: %v\n", p, err)
|
||||
continue
|
||||
}
|
||||
allowRegex = append(allowRegex, re)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue