Repository navigation
🖼️ fix: Preview Oversized LibreOffice PDFs from File Storage - #98
Merged
TomasPalsson merged 1 commit intoOct 26, 2026
Merged
Conversation
A LibreOffice preview embeds its PDF in the stored preview HTML, so any PDF over ~380 KB (the 512 KB attachment.text cap after base64) was dropped silently. A deck with a handful of chart images crosses that, and users got the text-only slide list instead of the rendered slides. When storage-backed office previews are on and the PDF is too big to embed, store a PDF shell instead: the same file-shell markers plus a `lc-doc-format=pdf` marker and the empty data slot. The viewer fills it from the existing download routes with `?preview=pdf`, which convert the stored file on demand (same auth, same size limit as the file shell). - tryLibreOfficePreview returns the PDF shell over the cap when asked - officeFileToPdf / sendOfficePdfPreview serve `?preview=pdf` on the owner and shared-link download routes - useOfficeFileShell requests the PDF for a PDF shell Co-authored-by: Claude <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
Why
Code-interpreter decks still show "High-fidelity renderer unavailable or returned no slide content. Showing the simplified slide-list view below." and a text-only list, even with LibreOffice previews live (#94, #95).
LibreOffice converts fine, but its PDF is embedded base64 in the stored preview HTML (
attachment.text, 512 KB cap). Any PDF over ~380 KB makestryLibreOfficePreviewreturnnullsilently. The storage-backed file shell (upstream LibreChat-AI#16518) only moved the source file out of the HTML, not the PDF. Repro: an 8-slide deck with a matplotlib chart per slide is 365 KB as.pptxand 466 KB as PDF, so it falls back to the slide list.What
Squash of upstream LibreChat-AI#17450 onto
aproorg/0.8.8:fileConfig.officePreview.enabledand the PDF is too big to embed, store a PDF shell. That is the file-shell markers, a newlc-doc-format=pdfmarker, and an empty data slot.?preview=pdfon the existing owner and shared-link download routes. It converts the stored file on demand behind the same auth, capped atofficePreview.fileSizeLimit, with a zip-bomb check.useOfficeFileShellfetches the PDF for a PDF shell and fills it. pdf.js renders the slides.Tests
packages/apinpx jest src/files→ 1195/1195. This includes the real-soffice integration tests for the shell over the cap and forofficeFileToPdf.data-providerfile-config→ 264/264.clientArtifacts + Files → 114/114.apifiles + share routes → 135/135.tsc, ESLint and Prettier are clean.?preview=pdfreturns the 465 KB PDF, and the filled shell renders all 8 slides in Chrome:Notes
ponytail:comment marks it). Store the PDF next to the file if repeat views get slow.OFFICE_PREVIEW_LIBREOFFICE=pptxis already set, becauseofficePreview.enableddefaults totrue.