fix: [document] PDF 생성 시 cross-origin 이미지 누락 수정
- /api/image-proxy 프록시 라우트 추가 (CORS 우회) - convertImagesToBase64에서 cross-origin 이미지를 프록시로 fetch
This commit is contained in:
@@ -173,8 +173,13 @@ export function DocumentViewer({
|
||||
const src = img.src;
|
||||
if (!src || src.startsWith('data:')) return;
|
||||
|
||||
// cross-origin 이미지는 서버 프록시를 통해 fetch (CORS 우회)
|
||||
const isSameOrigin = src.startsWith(window.location.origin) || src.startsWith('/');
|
||||
const fetchUrl = isSameOrigin ? src : `/api/image-proxy?url=${encodeURIComponent(src)}`;
|
||||
|
||||
try {
|
||||
const response = await fetch(src);
|
||||
const response = await fetch(fetchUrl);
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const blob = await response.blob();
|
||||
const dataUrl = await new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
Reference in New Issue
Block a user