diff --git a/CHANGELOG.md b/CHANGELOG.md index 28cb95e066..41529ab383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +- Fix error when a file or directory in the project contained a special char + like `&`, `(` or `)` (#1551, #1584 by @andreynering). + ## v3.36.0 - 2024-04-08 - Added support for diff --git a/internal/execext/exec.go b/internal/execext/exec.go index 925395fd5d..a04a7167e6 100644 --- a/internal/execext/exec.go +++ b/internal/execext/exec.go @@ -103,6 +103,9 @@ func IsExitError(err error) bool { func Expand(s string) (string, error) { s = filepath.ToSlash(s) s = strings.ReplaceAll(s, " ", `\ `) + s = strings.ReplaceAll(s, "&", `\&`) + s = strings.ReplaceAll(s, "(", `\(`) + s = strings.ReplaceAll(s, ")", `\)`) fields, err := shell.Fields(s, nil) if err != nil { return "", err