diff options
Diffstat (limited to 'app/api')
| -rw-r--r-- | app/api/dolce/download/route.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/api/dolce/download/route.ts b/app/api/dolce/download/route.ts index 9d5eb601..94fe35b4 100644 --- a/app/api/dolce/download/route.ts +++ b/app/api/dolce/download/route.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; -import { downloadDolceFile } from "@/lib/dolce/actions"; +import { downloadDolceFile, downloadLocalFile } from "@/lib/dolce-v2/actions"; export async function POST(request: NextRequest) { try { @@ -15,6 +15,19 @@ export async function POST(request: NextRequest) { console.log("[DOLCE Download API] 요청:", { fileId, userId, fileName }); + // 로컬 파일 다운로드 처리 + if (String(fileId).startsWith("LOCAL_")) { + const { buffer, fileName: localFileName } = await downloadLocalFile(fileId); + + return new NextResponse(buffer, { + headers: { + "Content-Type": "application/octet-stream", + "Content-Disposition": `attachment; filename*=UTF-8''${encodeURIComponent(localFileName)}`, + "Content-Length": buffer.byteLength.toString(), + }, + }); + } + // DOLCE API를 통해 파일 다운로드 const { blob, fileName: downloadFileName } = await downloadDolceFile({ fileId, |
