chore: fully revert shell.go to maintain absolute PR scope

This commit is contained in:
Andrew 2026-02-24 01:26:32 +00:00
parent 6a3f0975dc
commit 199aff0b1c

View file

@ -290,22 +290,10 @@ func (t *ExecTool) guardCommand(command, cwd string) string {
return "" return ""
} }
// Match absolute paths: Unix (starts with /) or Windows (X:\) pathPattern := regexp.MustCompile(`[A-Za-z]:\\[^\\\"']+|/[^\s\"']+`)
pathPattern := regexp.MustCompile(`(?:\s|^|["'|&;])(/[^\s\"'|&;:]+)|([A-Za-z]:\\[^\\\"'|&;:]+)`) matches := pathPattern.FindAllString(cmd, -1)
matches := pathPattern.FindAllStringSubmatch(cmd, -1)
for _, match := range matches {
raw := ""
if match[1] != "" {
raw = match[1] // Unix path
} else if match[2] != "" {
raw = match[2] // Windows path
}
if raw == "" {
continue
}
for _, raw := range matches {
p, err := filepath.Abs(raw) p, err := filepath.Abs(raw)
if err != nil { if err != nil {
continue continue