From e345e970230258b308e807498a9dfa9608ffc6e6 Mon Sep 17 00:00:00 2001 From: amal Date: Fri, 29 Aug 2025 14:36:48 +0800 Subject: [PATCH 1/2] upd: nama file saat upload di semua fitur mobile --- src/app/api/mobile/document/upload/route.ts | 4 ++-- src/app/api/mobile/project/file/[id]/route.ts | 2 +- src/app/api/mobile/project/route.ts | 2 +- src/app/api/mobile/task/file/[id]/route.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/api/mobile/document/upload/route.ts b/src/app/api/mobile/document/upload/route.ts index 95a0a53..eb5657e 100644 --- a/src/app/api/mobile/document/upload/route.ts +++ b/src/app/api/mobile/document/upload/route.ts @@ -60,9 +60,9 @@ export async function POST(request: Request) { for (var pair of body.entries()) { if (String(pair[0]).substring(0, 4) == "file") { const file = body.get(pair[0]) as File - const fileName = file.name + const fileName = decodeURIComponent(file.name) const fExt = file.name.split(".").pop() - let fName = file.name.replace("." + fExt, "") + let fName = fileName.replace("." + fExt, "") const cek = dataOmit.some((i: any) => i.file == fileName) if (cek) { const random = Math.floor(Math.random() * 1000) diff --git a/src/app/api/mobile/project/file/[id]/route.ts b/src/app/api/mobile/project/file/[id]/route.ts index 40d7648..69b591f 100644 --- a/src/app/api/mobile/project/file/[id]/route.ts +++ b/src/app/api/mobile/project/file/[id]/route.ts @@ -77,7 +77,7 @@ export async function PUT(request: Request, context: { params: { id: string } }) } const file = body.get("file") as File - const fileName = file.name + const fileName = decodeURIComponent(file.name) const dataCek = await prisma.project.count({ where: { diff --git a/src/app/api/mobile/project/route.ts b/src/app/api/mobile/project/route.ts index 69814bb..0ed08bc 100644 --- a/src/app/api/mobile/project/route.ts +++ b/src/app/api/mobile/project/route.ts @@ -227,7 +227,7 @@ export async function POST(request: Request) { if (String(pair[0]).substring(0, 4) == "file") { const file = body.get(pair[0]) as File const fExt = file.name.split(".").pop() - const fName = file.name.replace("." + fExt, "") + const fName = decodeURIComponent(file.name.replace("." + fExt, "")) const upload = await funUploadFile({ file: file, dirId: DIR.project }) if (upload.success) { await prisma.projectFile.create({ diff --git a/src/app/api/mobile/task/file/[id]/route.ts b/src/app/api/mobile/task/file/[id]/route.ts index e1eed89..77d660d 100644 --- a/src/app/api/mobile/task/file/[id]/route.ts +++ b/src/app/api/mobile/task/file/[id]/route.ts @@ -173,7 +173,7 @@ export async function PUT(request: Request, context: { params: { id: string } }) } const file = body.get("file") as File - const fileName = file.name + const fileName = decodeURIComponent(file.name) const dataCek = await prisma.divisionProject.count({ where: { From dce9366fab4676f10532628ee17ab8596340d425 Mon Sep 17 00:00:00 2001 From: amal Date: Fri, 29 Aug 2025 16:58:25 +0800 Subject: [PATCH 2/2] upd: api version --- src/app/api/version-app/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/version-app/route.ts b/src/app/api/version-app/route.ts index 0711a2d..91f22eb 100644 --- a/src/app/api/version-app/route.ts +++ b/src/app/api/version-app/route.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; export async function GET(request: Request) { try { - return NextResponse.json({ success: true, version: "1.7.7", tahap: "beta", update: "-api mobile; -tambah laporan pada project dan tugas divisi; -tambah upload link pada project dan tugas divisi; -tambah detail tanggal dan jam pada project dan tugas divisi" }, { status: 200 }); + return NextResponse.json({ success: true, version: "1.7.8", tahap: "beta", update: "-api mobile; -tambah laporan pada project dan tugas divisi; -tambah upload link pada project dan tugas divisi; -tambah detail tanggal dan jam pada project dan tugas divisi" }, { status: 200 }); } catch (error) { console.error(error); return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });