Files
wekan/server
Lauri Ojansivu 9b9c2fe6e4 Fix PDF/DOCX/XLSX/PPTX preview 415 when the optional canvas dep is missing
pdf-to-img rasterizes PDF pages through pdfjs-dist's optionalDependency
@napi-rs/canvas. A Docker/Snap build that skips optional dependencies, or
lacks a prebuilt binary for its target architecture, then throws on the
very first PDF preview - "Cannot load @napi-rs/canvas", "Cannot polyfill
DOMMatrix" - which the generic catch in server/routes/universalFileServer.js
turned into a bare 415 with the real error never logged.

@napi-rs/canvas is now a direct dependency so it installs the same way
every other required package does. Rasterization is also no longer
all-or-nothing: pdfjs-dist's text extraction does not need canvas, so when
rasterizing still fails for any reason the PDF preview now degrades to
text-only pages (dropped images, kept text) instead of failing outright -
the same graceful degradation the minimal viewer already applies to an
unreadable embedded image in a DOCX/PPTX/XLSX. The three document-preview
routes now log the caught error before returning 415.

Thanks to rmb82 and xet7 !

Fixes #6685,
2026-09-10 16:22:02 +03:00
..
2026-03-22 17:17:48 +02:00
2021-06-14 15:11:21 +02:00