From 8a19a6fa336768d8b6712752c9d713360067ecb0 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 8 Dec 2025 08:45:20 +0000 Subject: (최겸) 구매 피드백 수정, 안전담당자, pq항목 내 첨부, 내외자 구분, 도로명주소 api 반영(운영기준) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bidding/service.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/bidding') diff --git a/lib/bidding/service.ts b/lib/bidding/service.ts index ed20ad0c..840173c2 100644 --- a/lib/bidding/service.ts +++ b/lib/bidding/service.ts @@ -3255,20 +3255,23 @@ export async function increaseRoundOrRebid(biddingId: number, userId: string | u eq(biddingDocuments.documentType, 'company_proposal') ) )) - + console.log('existingDocuments', existingDocuments) if (existingDocuments.length > 0) { for (const doc of existingDocuments) { try { // 기존 파일 경로 확인 및 Buffer로 읽기 const { readFile, access, constants } = await import('fs/promises') - const { join } = await import('path') + const path = await import('path') // 파일 경로 정규화 - const oldFilePath = doc.filePath.startsWith('/uploads/') - ? join(process.cwd(), 'public', doc.filePath) - : doc.filePath.startsWith('/') - ? join(process.cwd(), 'public', doc.filePath) - : doc.filePath + // 1) 절대 경로면 그대로 사용 + // 2) /api/files/... 처럼 public 하위 상대 경로면 cwd/public 기준으로 변환 + // 3) 그 외 문자열은 그대로 시도 (기존 저장 경로) + let oldFilePath = doc.filePath + + if (!path.isAbsolute(oldFilePath)) { + oldFilePath = path.join(process.cwd(), 'public', oldFilePath.replace(/^\/+/, '')) + } // 파일 존재 여부 확인 try { -- cgit v1.2.3