From 87306f1dce90956b9da80fbc509b2c082e96c51b Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Fri, 16 Feb 2024 09:33:10 +0700 Subject: [PATCH] Fix unintent subfolder creation --- src/controllers/StorageController.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/StorageController.ts b/src/controllers/StorageController.ts index 1c93e08..7fa711b 100644 --- a/src/controllers/StorageController.ts +++ b/src/controllers/StorageController.ts @@ -166,13 +166,14 @@ export class DocumentController extends Controller { ) { const path = ["ระบบเงินเดือน", "เอกสารอ้างอิงผังเงินเดือน", id]; - if (!(await createFolder(path, id, true))) { + if (!(await createFolder(path.slice(0, -1), id, true))) { throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ ไม่สามารถสร้างแฟ้มได้"); } + const list = await listFile(path); if (!list || !Array.isArray(list)) { - throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ ไม่สามารถสร้างแฟ้มได้"); + throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ เข้าถึงรายการไฟล์ได้"); } let used: string[] = [];