Skip to content

🖼️ fix: Preview Oversized LibreOffice PDFs from File Storage - #98

Merged
TomasPalsson merged 1 commit into
aproorg/0.8.8from
fix/libreoffice-previews-from-storage-0.8.8
Oct 26, 2026
Merged

TomasPalsson merged 1 commit into
aproorg/0.8.8from
fix/libreoffice-previews-from-storage-0.8.8

Conversation

@TomasPalsson

Copy link
Copy Markdown

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 makes tryLibreOfficePreview return null silently. 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 .pptx and 466 KB as PDF, so it falls back to the slide list.

What

Squash of upstream LibreChat-AI#17450 onto aproorg/0.8.8:

  • PDF shell: when fileConfig.officePreview.enabled and the PDF is too big to embed, store a PDF shell. That is the file-shell markers, a new lc-doc-format=pdf marker, and an empty data slot.
  • ?preview=pdf on the existing owner and shared-link download routes. It converts the stored file on demand behind the same auth, capped at officePreview.fileSizeLimit, with a zip-bomb check.
  • useOfficeFileShell fetches the PDF for a PDF shell and fills it. pdf.js renders the slides.
  • PDFs that fit keep the inline path, unchanged.

Tests

  • packages/api npx jest src/files → 1195/1195. This includes the real-soffice integration tests for the shell over the cap and for officeFileToPdf.
  • data-provider file-config → 264/264. client Artifacts + Files → 114/114. api files + share routes → 135/135.
  • tsc, ESLint and Prettier are clean.
  • End to end: the 8-chart deck now stores a 6.5 KB PDF shell, ?preview=pdf returns the 465 KB PDF, and the filled shell renders all 8 slides in Chrome:

After: 8-chart deck rendered from the on-demand PDF

Notes

  • The PDF is re-converted on each view, through the existing one-at-a-time queue (a ponytail: comment marks it). Store the PDF next to the file if repeat views get slow.
  • No config change needed where OFFICE_PREVIEW_LIBREOFFICE=pptx is already set, because officePreview.enabled defaults to true.

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>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d146160-4494-477e-b252-4ae0db467da6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@TomasPalsson
TomasPalsson merged commit 04f3f55 into aproorg/0.8.8 Oct 26, 2026
32 of 36 checks passed
@TomasPalsson
TomasPalsson deleted the fix/libreoffice-previews-from-storage-0.8.8 branch October 26, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant