From 0362ee43518bc6e85ec5973697ff7b0210a53be8 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Thu, 27 Nov 2025 19:44:53 +0900
Subject: (김준회) dolce b4 MatchBatchFileDwg에서 파일네임을 다르게 응답해서,
 인덱스 순서로 매칭 로직 변경
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx')

diff --git a/lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx b/lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx
index 81d6f7f0..e34b76c7 100644
--- a/lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx
+++ b/lib/dolce/dialogs/b4-bulk-upload-dialog-v3.tsx
@@ -178,14 +178,20 @@ export function B4BulkUploadDialogV3({
       );
 
       // Store mapping results for later use (upload/save)
+      // Use the original file name from our request list as the key to ensure we can look it up later.
+      // The API response 'FileNm' might differ (e.g., missing extension), so we rely on the array index order (1:1).
       const newMappingResultsMap = new Map<string, MappingCheckResult>();
-      mappingResults.forEach((result) => {
-        newMappingResultsMap.set(result.FileNm, result);
+      parseResults.forEach((parseResult, index) => {
+        const result = mappingResults[index];
+        if (result) {
+           newMappingResultsMap.set(parseResult.file.name, result);
+        }
       });
       setMappingResultsMap(newMappingResultsMap);
 
       // 3. Merge results
       const finalResults: FileValidationResult[] = parseResults.map((parseResult) => {
+        // Retrieve by file name (now reliably mapped)
         const mappingResult = newMappingResultsMap.get(parseResult.file.name);
 
         // If mapping exists and is valid, it overrides local validation errors
-- 
cgit v1.2.3

