Skip to content

Commit

Permalink
fix: fix bug for files with special chars &()
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynering committed Apr 9, 2024
1 parent 43d8456 commit 2ddf82d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions internal/execext/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ddf82d

Please sign in to comment.