Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65021e1fe2 |
No files matched your search
@@ -5,7 +5,9 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/sausheong/harness/tool"
|
||||
)
|
||||
|
||||
@@ -61,6 +63,9 @@ func (t *EditFileTool) Execute(_ context.Context, input json.RawMessage) (tool.T
|
||||
}
|
||||
|
||||
in.Path = tool.ExpandHome(in.Path)
|
||||
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||
}
|
||||
in.Path = tool.ResolveExistingPath(in.Path)
|
||||
|
||||
if t.WorkDir != "" {
|
||||
|
||||
@@ -82,6 +82,9 @@ func (t *ReadFileTool) Execute(_ context.Context, input json.RawMessage) (tool.T
|
||||
}
|
||||
|
||||
in.Path = tool.ExpandHome(in.Path)
|
||||
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||
}
|
||||
in.Path = tool.ResolveExistingPath(in.Path)
|
||||
|
||||
if t.WorkDir != "" {
|
||||
|
||||
@@ -56,6 +56,9 @@ func (t *WriteFileTool) Execute(_ context.Context, input json.RawMessage) (tool.
|
||||
}
|
||||
|
||||
in.Path = tool.ExpandHome(in.Path)
|
||||
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||
}
|
||||
|
||||
if t.WorkDir != "" {
|
||||
if err := tool.ValidatePathInWorkDir(in.Path, t.WorkDir); err != nil {
|
||||
|
||||
Reference in new issue
Block a user