mirror of
https://github.com/go-task/task.git
synced 2025-04-15 11:56:34 +02:00
fix: fix bug for files with special chars &()
(#1584)
This commit is contained in:
parent
43d84560e5
commit
eb2783fcce
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# 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
|
## v3.36.0 - 2024-04-08
|
||||||
|
|
||||||
- Added support for
|
- Added support for
|
||||||
|
@ -103,6 +103,9 @@ func IsExitError(err error) bool {
|
|||||||
func Expand(s string) (string, error) {
|
func Expand(s string) (string, error) {
|
||||||
s = filepath.ToSlash(s)
|
s = filepath.ToSlash(s)
|
||||||
s = strings.ReplaceAll(s, " ", `\ `)
|
s = strings.ReplaceAll(s, " ", `\ `)
|
||||||
|
s = strings.ReplaceAll(s, "&", `\&`)
|
||||||
|
s = strings.ReplaceAll(s, "(", `\(`)
|
||||||
|
s = strings.ReplaceAll(s, ")", `\)`)
|
||||||
fields, err := shell.Fields(s, nil)
|
fields, err := shell.Fields(s, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user