Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix writing file in non-existing directory
Tomas Valenta496e14966cf6
diff --git a/api-service/playground/src/sessions/filesystemController.ts b/api-service/playground/src/sessions/filesystemController.tsindex c28ff5cfa..d3e5f855b 100644--- a/api-service/playground/src/sessions/filesystemController.ts+++ b/api-service/playground/src/sessions/filesystemController.ts@@ -9,6 +9,7 @@ import {BodyProp,} from 'tsoa'import { FileInfo as EntryInfo } from '@devbookhq/sdk'+import { dirname } from 'path'import { CachedSession } from './session'@@ -82,15 +83,13 @@ export class FilesystemController extends Controller {@Query() path: string,@BodyProp() content: string,) {- try {- await CachedSession- .findSession(sessionID)- .session- .filesystem!- .write(path, content)- } catch (err) {- console.error(err)- throw err- }+ const dir = dirname(path)++ const session = CachedSession+ .findSession(sessionID)+ .session++ await session.filesystem!.makeDir(dir)+ await session.filesystem!.write(path, content)}}