improvement(files): extend the OOXML size limits to the client previews - #6445
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Docx and xlsx workspace previews call The server Reviewed by Cursor Bugbot for commit e14f56c. Configure here. |
Greptile SummaryThe PR centralizes OOXML archive limits and applies a lightweight declared-size check before DOCX and XLSX browser previews parse uploaded files.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The shared constants preserve the server guard’s behavior, and the new DOCX and XLSX checks execute before their parsers while retaining existing cancellation and error handling.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/file-parsers/ooxml-preview-guard.ts | Adds a browser-safe declared-size guard that rejects entries or archives exceeding the shared OOXML limits. |
| apps/sim/lib/file-parsers/ooxml-limits.ts | Centralizes the unchanged total and per-entry limits plus the shared ZipBombError class. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/docx-preview.tsx | Runs the archive guard before loading and invoking the DOCX renderer while preserving cancellation handling. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/xlsx-preview.tsx | Runs the archive guard before loading SheetJS and parsing workbook data. |
| apps/sim/lib/file-parsers/zip-guard.ts | Reuses the shared limits and error class without changing the server-side validation algorithm. |
| apps/sim/lib/file-parsers/ooxml-preview-guard.test.ts | Covers ordinary archives, per-entry overflow, and aggregate-size overflow. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[OOXML file data] --> B[JSZip reads central directory]
B --> C{Declared sizes within shared limits?}
C -->|No| D[Show preview error]
C -->|Yes| E{Preview type}
E -->|DOCX| F[docx-preview renderer]
E -->|XLSX| G[SheetJS parser]
Reviews (1): Last reviewed commit: "improvement(files): extend the OOXML siz..." | Re-trigger Greptile
Summary
JSZip.loadAsync, no inflation) in the docx and xlsx previews before they render, matching the guard the pptx preview already hasType of Change
Testing
Unit tests for the shared client guard (per-entry cap, total cap, ordinary-doc acceptance) plus the existing zip-guard suite; type-check and lint clean.
Checklist