From 1363913352722a03e051b15297f72bf16d80106f Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Fri, 7 Nov 2025 17:39:36 +0900 Subject: (김준회) 돌체 업로드 MIME 타입 검증 문제 확장자로 처리 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enhanced-document-service.ts | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'lib/vendor-document-list/enhanced-document-service.ts') diff --git a/lib/vendor-document-list/enhanced-document-service.ts b/lib/vendor-document-list/enhanced-document-service.ts index 2a81ddec..bb497f3b 100644 --- a/lib/vendor-document-list/enhanced-document-service.ts +++ b/lib/vendor-document-list/enhanced-document-service.ts @@ -1609,7 +1609,21 @@ export async function getDocumentDetails(documentId: number) { const docNumber = formData.get(`docNumber_${i}`) as string const revision = formData.get(`revision_${i}`) as string - if (!file || !docNumber) continue + // 디버깅 로그 추가 + console.log(`📋 파일 ${i} 처리:`, { + fileName: file?.name, + fileType: file?.type, + fileSize: file?.size, + docNumber, + revision, + hasFile: !!file, + hasDocNumber: !!docNumber + }) + + if (!file || !docNumber) { + console.warn(`⚠️ 파일 ${i} 스킵: file=${!!file}, docNumber=${!!docNumber}`) + continue + } if (!fileGroups.has(docNumber)) { fileGroups.set(docNumber, []) @@ -1746,6 +1760,14 @@ export async function getDocumentDetails(documentId: number) { } // 파일 저장 + console.log(`💾 파일 저장 시작:`, { + fileName: fileInfo.file.name, + fileType: fileInfo.file.type, + fileSize: fileInfo.file.size, + docNumber, + revision: fileInfo.revision + }) + const saveResult = await saveFile({ file: fileInfo.file, directory: `documents/${existingDoc.id}/revisions/${revisionId}`, @@ -1754,8 +1776,17 @@ export async function getDocumentDetails(documentId: number) { }) if (!saveResult.success) { + console.error(`❌ 파일 저장 실패:`, { + fileName: fileInfo.file.name, + error: saveResult.error + }) throw new Error(saveResult.error || "파일 저장 실패") } + + console.log(`✅ 파일 저장 성공:`, { + fileName: fileInfo.file.name, + publicPath: saveResult.publicPath + }) // 첨부파일 정보 저장 const [newAttachment] = await db.insert(documentAttachments).values({ -- cgit v1.2.3