diff options
Diffstat (limited to 'lib/items/table')
| -rw-r--r-- | lib/items/table/import-excel-button.tsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/items/table/import-excel-button.tsx b/lib/items/table/import-excel-button.tsx index 484fd778..845f5fe2 100644 --- a/lib/items/table/import-excel-button.tsx +++ b/lib/items/table/import-excel-button.tsx @@ -16,6 +16,7 @@ import { } from "@/components/ui/dialog" import { Progress } from "@/components/ui/progress" import { processFileImport } from "./import-item-handler" // 별도 파일로 분리 +import { decryptWithServerAction } from "@/components/drm/drmUtils" interface ImportItemButtonProps { onSuccess?: () => void @@ -55,8 +56,19 @@ export function ImportItemButton({ onSuccess }: ImportItemButtonProps) { setProgress(0) setError(null) - // 파일을 ArrayBuffer로 읽기 - const arrayBuffer = await file.arrayBuffer(); + // DRM 복호화 처리 - 서버 액션 직접 호출 + let arrayBuffer: ArrayBuffer; + try { + setProgress(10); + toast.info("파일 복호화 중..."); + arrayBuffer = await decryptWithServerAction(file); + setProgress(30); + } catch (decryptError) { + console.error("파일 복호화 실패, 원본 파일 사용:", decryptError); + toast.warning("파일 복호화에 실패하여 원본 파일을 사용합니다."); + // 복호화 실패 시 원본 파일 사용 + arrayBuffer = await file.arrayBuffer(); + } // ExcelJS 워크북 로드 const workbook = new ExcelJS.Workbook(); |
