diff --git a/hakit/config.json b/hakit/config.json index ae75c5d..282bf02 100644 --- a/hakit/config.json +++ b/hakit/config.json @@ -1,6 +1,6 @@ { "name": "Hakit", - "version": "1.0.27", + "version": "1.0.28", "slug": "hakit", "init": false, "ingress": true, diff --git a/hakit/server/routes/write-file.ts b/hakit/server/routes/write-file.ts index 48d24b7..3a6effd 100644 --- a/hakit/server/routes/write-file.ts +++ b/hakit/server/routes/write-file.ts @@ -2,6 +2,7 @@ import { Request, Response } from 'express'; import { join } from 'path'; import { writeFile as fsWriteFile } from 'fs/promises'; import { APP_DIRECTORY } from '../constants.js'; +import { ensureDirectoryExists } from '../helpers/index.js'; export async function writeFile(req: Request, res: Response) { try { @@ -12,6 +13,7 @@ export async function writeFile(req: Request, res: Response) { } const filePath = join(APP_DIRECTORY, filename); + ensureDirectoryExists(filePath, false); const fileContents = typeof content === 'string' ? content : JSON.stringify(content, null, 2); await fsWriteFile(filePath, fileContents, 'utf8');