PWA: Mehr Debug-Logs für File-Viewer (zeigt ob PDF.js geladen ist) [deploy]
All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 5s
All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 5s
This commit is contained in:
parent
69f50b0fe5
commit
99c5537a2d
1 changed files with 9 additions and 0 deletions
9
app.js
9
app.js
|
|
@ -1796,13 +1796,22 @@ function openFileViewer({ url, blob, mime }, filename, relpath) {
|
||||||
const isImage = (mime || '').startsWith('image/');
|
const isImage = (mime || '').startsWith('image/');
|
||||||
const isPdf = (mime || '').includes('pdf') || /\.pdf$/i.test(filename);
|
const isPdf = (mime || '').includes('pdf') || /\.pdf$/i.test(filename);
|
||||||
|
|
||||||
|
console.log('[FILE] openFileViewer:', {filename, mime, isPdf, pdfjs: typeof pdfjs, blobSize: blob.size});
|
||||||
|
|
||||||
if (isPdf && typeof pdfjs !== 'undefined') {
|
if (isPdf && typeof pdfjs !== 'undefined') {
|
||||||
|
console.log('[FILE] → PDF-Viewer aufrufen');
|
||||||
openPdfViewer(blob, filename, relpath);
|
openPdfViewer(blob, filename, relpath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPdf && typeof pdfjs === 'undefined') {
|
||||||
|
console.warn('[FILE] PDF.js ist NICHT geladen!');
|
||||||
|
showToast('⚠️ PDF.js nicht verfügbar, Download stattdessen', 'error');
|
||||||
|
}
|
||||||
|
|
||||||
if (!isImage) {
|
if (!isImage) {
|
||||||
// Alles außer Bildern + PDFs: Download
|
// Alles außer Bildern + PDFs: Download
|
||||||
|
console.log('[FILE] → Download-Fallback');
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
a.download = filename || 'download';
|
a.download = filename || 'download';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue