From 22a398024c1ad735f1a60fd3957b4020f3cf133c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Sat, 14 Mar 2026 08:29:20 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[inspection]=20=EA=B2=80=EC=82=AC=20?= =?UTF-8?q?=EB=AC=B8=EC=84=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20URL=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20file=5Fid=20=EA=B8=B0=EB=B0=98=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getImageUrl 파라미터 순서 변경 (file_id 우선) - 레거시 tenant path 직접 접근 제거, R2 프록시 사용 - SectionImage에 file_id prop 추가 --- .../documents/TemplateInspectionContent.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx b/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx index 6300cc0f..848be3bf 100644 --- a/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx +++ b/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx @@ -68,19 +68,14 @@ interface TemplateInspectionContentProps { // ===== 유틸 ===== -/** API 저장소 이미지 URL 생성 — R2 전환 후 프록시 사용 */ -function getImageUrl(path: string | null | undefined, fileId?: number | null): string { - if (!path && !fileId) return ''; +/** API 저장소 이미지 URL 생성 — file_id 기반 R2 프록시 사용 */ +function getImageUrl(fileId?: number | null, path?: string | null): string { // file_id가 있으면 프록시 경로 사용 if (fileId) return `/api/proxy/files/${fileId}/view`; + // fallback: 레거시 경로 if (!path) return ''; if (path.startsWith('http://') || path.startsWith('https://')) return path; if (path.startsWith('/api/proxy/')) return path; - // API 업로드 형식 (tenant path: 287/temp/2026/02/xxx.jpg) → API 스토리지 직접 접근 - if (/^\d+\//.test(path)) { - const apiUrl = process.env.NEXT_PUBLIC_API_URL || ''; - return `${apiUrl}/storage/tenants/${path}`; - } return path; } @@ -289,10 +284,10 @@ function buildBendingProducts(order: WorkOrder): BendingProduct[] { } // ===== 이미지 섹션 컴포넌트 (onError 핸들링) ===== -function SectionImage({ section }: { section: { id: number; title?: string; name?: string; image_path?: string | null } }) { +function SectionImage({ section }: { section: { id: number; title?: string; name?: string; image_path?: string | null; file_id?: number | null } }) { const [imgError, setImgError] = useState(false); const title = section.title || section.name || ''; - const url = section.image_path ? getImageUrl(section.image_path) : ''; + const url = (section.file_id || section.image_path) ? getImageUrl(section.file_id, section.image_path) : ''; return (