Fix: PDF 다운로드 시 캐시 문제 해결
- 문서 뷰어에서 PDF 다운로드 시 최신 문서 정보를 재로드 - 캐시된 matched_pdf_id가 null인 경우 데이터베이스에서 최신 정보 가져오기 - PDF 매칭 정보 업데이트 로그 추가
This commit is contained in:
@@ -90,6 +90,13 @@ window.bookEditorApp = () => ({
|
||||
|
||||
console.log('📄 서적 문서들:', this.documents.length, '개');
|
||||
|
||||
// 각 문서의 PDF 매칭 상태 확인
|
||||
this.documents.forEach((doc, index) => {
|
||||
console.log(`📄 문서 ${index + 1}: ${doc.title}`);
|
||||
console.log(` - matched_pdf_id: ${doc.matched_pdf_id || 'null'}`);
|
||||
console.log(` - sort_order: ${doc.sort_order || 'null'}`);
|
||||
});
|
||||
|
||||
// 사용 가능한 PDF 문서들 로드 (현재 서적의 PDF만)
|
||||
console.log('🔍 현재 서적 ID:', this.bookId);
|
||||
console.log('🔍 전체 문서 수:', allDocuments.length);
|
||||
|
||||
@@ -1020,6 +1020,28 @@ window.documentViewer = () => ({
|
||||
pdf_path: this.document.pdf_path
|
||||
});
|
||||
|
||||
// 캐시를 무시하고 최신 문서 정보를 다시 가져오기
|
||||
console.log('🔄 최신 문서 정보 재로드 중...');
|
||||
try {
|
||||
const freshDocument = await this.api.getDocument(this.document.id);
|
||||
console.log('📄 최신 문서 정보:', {
|
||||
id: freshDocument.id,
|
||||
matched_pdf_id: freshDocument.matched_pdf_id,
|
||||
pdf_path: freshDocument.pdf_path
|
||||
});
|
||||
|
||||
// 최신 정보로 업데이트
|
||||
if (freshDocument.matched_pdf_id !== this.document.matched_pdf_id) {
|
||||
console.log('🔄 PDF 매칭 정보 업데이트:', {
|
||||
old: this.document.matched_pdf_id,
|
||||
new: freshDocument.matched_pdf_id
|
||||
});
|
||||
this.document.matched_pdf_id = freshDocument.matched_pdf_id;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 최신 문서 정보 로드 실패:', error);
|
||||
}
|
||||
|
||||
// 1. 현재 문서 자체가 PDF인 경우
|
||||
if (this.document.pdf_path) {
|
||||
console.log('📄 현재 문서가 PDF - 직접 다운로드');
|
||||
|
||||
Reference in New Issue
Block a user