Repository navigation
Fix email PDF preview blocked by Content Security Policy - #154
Open
cgroschupp wants to merge 1 commit into
Open
cgroschupp wants to merge 1 commit into
cgroschupp wants to merge 1 commit into
Conversation
Signed-off-by: Christian Groschupp <christian@groschupp.org>
cgroschupp
force-pushed
the
feature/blob-to-Uint8Array
branch
from
October 30, 2026 08:00
ab7b6bd to
a926fd6
Compare
Contributor
|
FYI It worked when I (and reviewers) tested, because Nextcloud Talk or Assistant was installed. It widens the CSP to allow I'd like to avoid just widening the CSP (using The proper fix would be to directly call PDF.js and no rely on a PDF viewer being installed. In hindsight something else then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening an email failed because PDF.js tried to load the generated PDF through a Blob URL, which was blocked by the PDF viewer’s Content Security Policy:
I could only view an
.emlfile in Firefox 159 after adding the following toapps/files_pdfviewer/lib/Controller/DisplayController.php:This change removes the need for that workaround by passing the generated PDF directly to PDF.js as a
Uint8ArraythroughPDFViewerApplication.open({ data })after initialization. No Blob URL or CSP change is required.🤖 AI (if applicable)