-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: images are not included in PDF exports #16076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryFixed PDF export to include images by providing custom
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant PDFExporter
participant CustomResolver as resolveFileUrl
participant Browser
participant FileController
participant FilePathGuard
participant FileStorage
User->>PDFExporter: Export note to PDF
PDFExporter->>CustomResolver: Request image (signed URL)
Note over CustomResolver: URL includes JWT token in path<br/>(e.g., /files/folder/TOKEN/image.jpg)
CustomResolver->>Browser: fetch(url, {mode: 'cors', credentials: 'omit'})
Browser->>FileController: GET /files/.../TOKEN/...
FileController->>FilePathGuard: Verify JWT token
FilePathGuard->>FilePathGuard: Extract token from URL path
FilePathGuard->>FilePathGuard: Verify JWT signature & workspace
FilePathGuard-->>FileController: Authorized (workspaceId added to request)
FileController->>FileStorage: Fetch file stream
FileStorage-->>FileController: File stream
FileController-->>Browser: Image data (with CORS headers)
Browser-->>CustomResolver: Blob
CustomResolver-->>PDFExporter: Image blob
PDFExporter->>User: Generated PDF with images
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where PDF export failed to include images stored as signed URLs. The problem was that BlockNote's default resolveFileUrl implementation uses a public CORS proxy that cannot access authenticated/signed URLs. The solution overrides this function to fetch resources directly from the client.
Key Changes
- Added custom
resolveFileUrlfunction to PDFExporter configuration - Implemented direct fetch with CORS mode and omitted credentials for signed URL access
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
...modules/action-menu/actions/record-actions/single-record/utils/exportBlockNoteEditorToPdf.ts
Outdated
Show resolved
Hide resolved
...modules/action-menu/actions/record-actions/single-record/utils/exportBlockNoteEditorToPdf.ts
Outdated
Show resolved
Hide resolved
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:22974 This environment will automatically shut down when the PR is closed or after 5 hours. |
Description
resolveFileUrluses a public CORS proxy that couldn’t access authenticated/signed URLsVisual Appearance
Screen.Recording.2025-11-26.at.1.56.03.AM.mov