From e270e477f362dd68249bb4a013c66eab293bba82 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Thu, 7 Aug 2025 05:04:39 +0000
Subject: (최겸) PQ요청+기본계약 로직 수정(한글화 미적용)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/basic-contract/viewer/basic-contract-sign-viewer.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'lib/basic-contract/viewer/basic-contract-sign-viewer.tsx')

diff --git a/lib/basic-contract/viewer/basic-contract-sign-viewer.tsx b/lib/basic-contract/viewer/basic-contract-sign-viewer.tsx
index 0409151e..8995c560 100644
--- a/lib/basic-contract/viewer/basic-contract-sign-viewer.tsx
+++ b/lib/basic-contract/viewer/basic-contract-sign-viewer.tsx
@@ -108,8 +108,17 @@ export function BasicContractSignViewer({
   // 문서 로드
   useEffect(() => {
     if (!instance || !filePath) return;
+    console.log("📄 파일 로드 시도:", { filePath });
     
-    loadDocument(instance, filePath);
+    
+    // filePath를 /api/files/ 엔드포인트를 통해 접근하도록 변환
+    // 한글 파일명의 경우 URL 인코딩 처리
+    const normalizedPath = filePath.startsWith('/') ? filePath.substring(1) : filePath;
+    const encodedPath = normalizedPath.split('/').map(part => encodeURIComponent(part)).join('/');
+    const apiFilePath = `/api/files/${encodedPath}`;
+    
+    console.log("📄 파일 로드 시도:", { originalPath: filePath, encodedPath: apiFilePath });
+    loadDocument(instance, apiFilePath);
   }, [instance, filePath]);
 
   // 간소화된 문서 로드 함수
-- 
cgit v1.2.3

