diff options
| author | Ed Zynda <[email protected]> | 2025-05-16 18:56:39 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-16 10:56:39 -0500 |
| commit | c92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1 (patch) | |
| tree | cbfa8e2770a653d9a3e29963e99f79bd430e9e4e /internal/llm/tools/edit.go | |
| parent | 4a444e9c9b7674c6b07a1a012a6467e45c3af1ec (diff) | |
| download | opencode-c92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1.tar.gz opencode-c92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1.zip | |
fix: Show correct file paths in permission window (#25)
* Fix paths in permission window to show relative paths
* Fix paths in permission window to show actual file paths
Diffstat (limited to 'internal/llm/tools/edit.go')
| -rw-r--r-- | internal/llm/tools/edit.go | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/internal/llm/tools/edit.go b/internal/llm/tools/edit.go index 5516db5d7..9837c018d 100644 --- a/internal/llm/tools/edit.go +++ b/internal/llm/tools/edit.go @@ -196,16 +196,11 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string) content, filePath, ) - rootDir := config.WorkingDirectory() - permissionPath := filepath.Dir(filePath) - if strings.HasPrefix(filePath, rootDir) { - permissionPath = rootDir - } p := e.permissions.Request( ctx, permission.CreatePermissionRequest{ SessionID: sessionID, - Path: permissionPath, + Path: filePath, ToolName: EditToolName, Action: "write", Description: fmt.Sprintf("Create file %s", filePath), @@ -308,16 +303,11 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string filePath, ) - rootDir := config.WorkingDirectory() - permissionPath := filepath.Dir(filePath) - if strings.HasPrefix(filePath, rootDir) { - permissionPath = rootDir - } p := e.permissions.Request( ctx, permission.CreatePermissionRequest{ SessionID: sessionID, - Path: permissionPath, + Path: filePath, ToolName: EditToolName, Action: "write", Description: fmt.Sprintf("Delete content from file %s", filePath), @@ -429,16 +419,11 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS newContent, filePath, ) - rootDir := config.WorkingDirectory() - permissionPath := filepath.Dir(filePath) - if strings.HasPrefix(filePath, rootDir) { - permissionPath = rootDir - } p := e.permissions.Request( ctx, permission.CreatePermissionRequest{ SessionID: sessionID, - Path: permissionPath, + Path: filePath, ToolName: EditToolName, Action: "write", Description: fmt.Sprintf("Replace content in file %s", filePath), |
