From 434005b170bede9bd558ac772ddfde112c1ceb11 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 20 Aug 2026 13:57:19 +0200 Subject: [PATCH] fix: pass PDF bytes to pdf.js instead of fetching the blob: URL, which CSP connect-src blocks #871 --- components/files/file-preview-modal.tsx | 11 +++++++++-- components/files/pdf-mobile-viewer.tsx | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/components/files/file-preview-modal.tsx b/components/files/file-preview-modal.tsx index 666c8429a..fb8e3ea7a 100644 --- a/components/files/file-preview-modal.tsx +++ b/components/files/file-preview-modal.tsx @@ -155,6 +155,11 @@ export function FilePreviewModal({ name, onClose, onDownload, getFileContent }: // (text/html, image/svg+xml, ...) in a new tab would execute it in-origin. const [canOpenInNewTab, setCanOpenInNewTab] = useState(false); const [emlContent, setEmlContent] = useState(null); + // The PDF blob itself, kept alongside its object URL: the pdf.js mobile + // viewer needs the bytes, because fetching the blob: URL is blocked by CSP + // connect-src (#871). The URL is still what the