feat: add file serving endpoint GET /api/documents/{id}/file

Returns original document file from NAS. Fixes 404 on PDF/image
viewer in frontend. Updated frontend iframe/img src to match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-03 08:32:51 +09:00
parent 62f5eccb96
commit e14084d5cd
2 changed files with 25 additions and 2 deletions

View File

@@ -56,12 +56,12 @@
</div>
{:else if viewerType === 'pdf'}
<iframe
src="/documents/file/{doc.id}"
src="/api/documents/{doc.id}/file"
class="w-full h-[80vh] rounded"
title={doc.title}
></iframe>
{:else if viewerType === 'image'}
<img src="/documents/file/{doc.id}" alt={doc.title} class="max-w-full rounded" />
<img src="/api/documents/{doc.id}/file" alt={doc.title} class="max-w-full rounded" />
{:else if viewerType === 'synology'}
<div class="text-center py-10">
<p class="text-[var(--text-dim)] mb-4">Synology Office 문서</p>