From e377662935a725080bec431fcc7c5367c85ae6dd Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 4 Jun 2025 17:27:04 +0200 Subject: [PATCH] Add debug logging for file preview errors - Add console logging when setting preview proxy URL - Enhance error handler to capture and log error event details - Log current preview URL on load failure for debugging --- components/FilePreviewModal.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/FilePreviewModal.vue b/components/FilePreviewModal.vue index 33acb2a..82fd2e8 100644 --- a/components/FilePreviewModal.vue +++ b/components/FilePreviewModal.vue @@ -158,7 +158,9 @@ const loadPreview = async () => { // For images and PDFs, use the proxy endpoint to avoid CORS issues if (isImage.value || isPdf.value) { // Use the proxy endpoint that serves the file directly - previewUrl.value = `/api/files/proxy-preview?fileName=${encodeURIComponent(props.file.name)}`; + const proxyUrl = `/api/files/proxy-preview?fileName=${encodeURIComponent(props.file.name)}`; + console.log('Setting preview URL to:', proxyUrl); + previewUrl.value = proxyUrl; // The loading state will be handled by the image/iframe onload event } else { throw new Error('File type does not support preview'); @@ -170,7 +172,9 @@ const loadPreview = async () => { }; // Handle preview load error -const handlePreviewError = () => { +const handlePreviewError = (event: any) => { + console.error('Preview load error:', event); + console.error('Current preview URL:', previewUrl.value); error.value = 'Failed to load preview'; loading.value = false; };