feat: 품목관리 기능 개선 및 문서화 업데이트
- 품목 상세/수정 페이지 파일 다운로드 기능 개선 - DynamicItemForm 파일 업로드 UI/UX 개선 (시방서, 인정서) - BendingDiagramSection 조립/절곡 부품 전개도 통합 - API proxy route 품목 타입별 라우팅 개선 - ItemListClient 파일 다운로드 유틸리티 적용 - 품목코드 중복 체크 및 다이얼로그 추가 문서화: - DynamicItemForm 훅 분리 계획서 추가 (2161줄 → 900줄 목표) - 백엔드 API 마이그레이션 문서 추가 - 대용량 파일 처리 전략 가이드 추가 - 테넌트 데이터 격리 감사 문서 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -249,16 +249,46 @@ async function proxyRequest(
|
||||
}
|
||||
|
||||
// 6. 응답 데이터 읽기
|
||||
const responseData = await backendResponse.text();
|
||||
console.log('🔵 [PROXY] Response status:', backendResponse.status);
|
||||
const responseContentType = backendResponse.headers.get('content-type') || 'application/json';
|
||||
|
||||
// 7. 클라이언트로 응답 전달
|
||||
const clientResponse = new NextResponse(responseData, {
|
||||
status: backendResponse.status,
|
||||
headers: {
|
||||
'Content-Type': backendResponse.headers.get('content-type') || 'application/json',
|
||||
},
|
||||
});
|
||||
// 7. 바이너리 파일 vs 텍스트/JSON 구분
|
||||
// 파일 다운로드 (PDF, 이미지, 등)는 바이너리로 처리해야 손상되지 않음
|
||||
const isBinaryResponse =
|
||||
responseContentType.includes('application/pdf') ||
|
||||
responseContentType.includes('application/octet-stream') ||
|
||||
responseContentType.includes('image/') ||
|
||||
responseContentType.includes('application/zip') ||
|
||||
responseContentType.includes('application/vnd') ||
|
||||
responseContentType.includes('application/msword') ||
|
||||
responseContentType.includes('application/x-');
|
||||
|
||||
let clientResponse: NextResponse;
|
||||
|
||||
if (isBinaryResponse) {
|
||||
// 바이너리 파일: arrayBuffer로 읽어서 그대로 전달
|
||||
console.log('📄 [PROXY] Binary response detected:', responseContentType);
|
||||
const binaryData = await backendResponse.arrayBuffer();
|
||||
|
||||
clientResponse = new NextResponse(binaryData, {
|
||||
status: backendResponse.status,
|
||||
headers: {
|
||||
'Content-Type': responseContentType,
|
||||
'Content-Disposition': backendResponse.headers.get('content-disposition') || '',
|
||||
'Content-Length': backendResponse.headers.get('content-length') || '',
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// JSON/텍스트: text로 읽어서 전달
|
||||
const responseData = await backendResponse.text();
|
||||
|
||||
clientResponse = new NextResponse(responseData, {
|
||||
status: backendResponse.status,
|
||||
headers: {
|
||||
'Content-Type': responseContentType,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 8. 토큰이 갱신되었으면 새 쿠키 설정
|
||||
if (newTokens && newTokens.accessToken) {
|
||||
|
||||
Reference in New Issue
Block a user