mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: handle empty workspace folders array to prevent path type errors
- Replace .at(0) with safe array access using length checks - Fixes "path argument must be of type string" error when workspace is empty - Addresses regression introduced between v3.25.17 and v3.26.7 Fixes #7695
This commit is contained in:
parent
db095b7feb
commit
f276e68133
1 changed files with 4 additions and 1 deletions
|
|
@ -86,7 +86,10 @@ const createServerTypeSchema = () => {
|
|||
type: z.enum(["stdio"]).optional(),
|
||||
command: z.string().min(1, "Command cannot be empty"),
|
||||
args: z.array(z.string()).optional(),
|
||||
cwd: z.string().default(() => vscode.workspace.workspaceFolders?.at(0)?.uri.fsPath ?? process.cwd()),
|
||||
cwd: z.string().default(() => {
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders
|
||||
return workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0].uri.fsPath : process.cwd()
|
||||
}),
|
||||
env: z.record(z.string()).optional(),
|
||||
// Ensure no SSE fields are present
|
||||
url: z.undefined().optional(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue