From cf8dac0c6490469dab88a560004b0c07dbd48612 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 18 Sep 2025 00:23:40 +0000 Subject: (대표님) rfq, 계약, 서명 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/contracts/get-template/route.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'app/api/contracts/get-template') diff --git a/app/api/contracts/get-template/route.ts b/app/api/contracts/get-template/route.ts index ff42196f..b7965481 100644 --- a/app/api/contracts/get-template/route.ts +++ b/app/api/contracts/get-template/route.ts @@ -12,14 +12,18 @@ export async function POST(request: NextRequest) { { status: 400 } ); } + + // /api/files로 시작하는 경우 제거 + const cleanPath = templatePath.startsWith('/api/files') + ? templatePath.slice('/api/files'.length) + : templatePath; + const isDev = process.env.NODE_ENV === 'development'; - const fullPath = - isDev ? - path.join(process.cwd(), `public`, templatePath) - : - path.join(`${process.env.NAS_PATH}`, templatePath); - + const fullPath = isDev + ? path.join(process.cwd(), `public`, cleanPath) + : path.join(`${process.env.NAS_PATH}`, cleanPath); + const fileBuffer = await readFile(fullPath); return new NextResponse(fileBuffer, { -- cgit v1.2.3