chore: fully revert shell.go to maintain absolute PR scope
This commit is contained in:
parent
6a3f0975dc
commit
199aff0b1c
1 changed files with 3 additions and 15 deletions
|
|
@ -290,22 +290,10 @@ func (t *ExecTool) guardCommand(command, cwd string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Match absolute paths: Unix (starts with /) or Windows (X:\)
|
||||
pathPattern := regexp.MustCompile(`(?:\s|^|["'|&;])(/[^\s\"'|&;:]+)|([A-Za-z]:\\[^\\\"'|&;:]+)`)
|
||||
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
|
||||
}
|
||||
pathPattern := regexp.MustCompile(`[A-Za-z]:\\[^\\\"']+|/[^\s\"']+`)
|
||||
matches := pathPattern.FindAllString(cmd, -1)
|
||||
|
||||
for _, raw := range matches {
|
||||
p, err := filepath.Abs(raw)
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue