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
This commit is contained in:
parent
9e9c667d1f
commit
e377662935
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue