fix: [storage] R2 테넌트 파일 경로 URL 변환 추가
- tenant path 패턴(숫자/) 감지하여 API URL 프리픽스 추가
- /storage/tenants/{path} R2 프록시 라우트와 연동
This commit is contained in:
@@ -76,7 +76,11 @@ function getImageUrl(path: string | null | undefined, fileId?: number | null): s
|
||||
if (!path) return '';
|
||||
if (path.startsWith('http://') || path.startsWith('https://')) return path;
|
||||
if (path.startsWith('/api/proxy/')) return path;
|
||||
// R2 전환 후 /storage/ 직접 접근 불가 — 경로만 반환 (fallback)
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user