From 476f8b9ff04b15c072621239cd4ca3240d5e522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Fri, 20 Mar 2026 12:37:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[worker]=20=EC=A4=91=EA=B0=84=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EC=84=B1=EC=A0=81=EC=84=9C=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20presigned=20URL=20=EC=A7=80=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getImageUrl()에서 image_url(presigned URL) 우선 사용 - SectionImage 타입에 image_url 추가 --- .../documents/TemplateInspectionContent.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx b/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx index 848be3bf..064d6643 100644 --- a/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx +++ b/src/components/production/WorkOrders/documents/TemplateInspectionContent.tsx @@ -68,15 +68,13 @@ interface TemplateInspectionContentProps { // ===== 유틸 ===== -/** API 저장소 이미지 URL 생성 — file_id 기반 R2 프록시 사용 */ -function getImageUrl(fileId?: number | null, path?: string | null): string { - // file_id가 있으면 프록시 경로 사용 +/** API 저장소 이미지 URL 생성 — image_url(presigned URL) 우선 사용 */ +function getImageUrl(fileId?: number | null, path?: string | null, imageUrl?: string | null): string { + if (imageUrl) return imageUrl; 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; - return path; + if (path.startsWith('http')) return path; + return ''; } /** field_values.reference_attribute에서 작업 아이템의 실제 치수를 resolve */ @@ -284,10 +282,10 @@ function buildBendingProducts(order: WorkOrder): BendingProduct[] { } // ===== 이미지 섹션 컴포넌트 (onError 핸들링) ===== -function SectionImage({ section }: { section: { id: number; title?: string; name?: string; image_path?: string | null; file_id?: number | null } }) { +function SectionImage({ section }: { section: { id: number; title?: string; name?: string; image_path?: string | null; file_id?: number | null; image_url?: string | null } }) { const [imgError, setImgError] = useState(false); const title = section.title || section.name || ''; - const url = (section.file_id || section.image_path) ? getImageUrl(section.file_id, section.image_path) : ''; + const url = (section.image_url || section.file_id || section.image_path) ? getImageUrl(section.file_id, section.image_path, section.image_url) : ''; return (