fix delete file s3

This commit is contained in:
AdisakKanthawilang 2025-02-06 11:23:21 +07:00
parent aaf7944f01
commit c87ae27070

View file

@ -695,7 +695,22 @@ export class SubFileController extends Controller {
@Path() subId: string,
@Path() file: string,
) {
const result = await deleteFile([name, group, id, subId], file);
if (name !== "ระบบประเมิน") {
const rawPath = [
name,
group,
id,
file
];
const fullPath = rawPath
.filter((path) => path !== undefined && path !== null)
.join("/");
const path = fullPath;
return await s3DeleteFile(path);
}
const result = await deleteFile([name, group, id, subId], file);
if (!result) {
throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์ ไม่สามารถลบไฟล์ ได้");