Tile thumbnails for PDF, office documents, SVG and HEIC #1101

Closed
opened 2026-11-04 03:11:00 +00:00 by Cordy · 4 comments
Owner

Gap (v0.7 feature-gap research, 2026-11-04, decided by Nikola). Tile and list thumbnails are made for jpg, png, gif, webp and bmp only (internal/api/thumb.go:17-20 at 0e0885db, VERIFIED). PDFs and office files get an icon in tiles, although the details pane already renders a first page (pdf.js, #629/#630; office via the converter).

Competitors. OpenCloud and Seafile show thumbnails for PDF and office files; Nextcloud ships image/text previews by default and calls the others optional for security reasons (research-nextcloud-files.md).

To research and decide when worked on. Server-side (converter, pdfium per #630's B2) vs client-side generation; cache and its invalidation on save; HEIC licensing; SVG sanitising; cost on large folders; encrypted storage; multi-instance cache (#742).

Refs: scratch/b7e/backlog/gap-v07/research-v07-gaps.md A13, #630.

**Gap (v0.7 feature-gap research, 2026-11-04, decided by Nikola).** Tile and list thumbnails are made for jpg, png, gif, webp and bmp only (`internal/api/thumb.go:17-20` at 0e0885db, VERIFIED). PDFs and office files get an icon in tiles, although the details pane already renders a first page (pdf.js, #629/#630; office via the converter). **Competitors.** OpenCloud and Seafile show thumbnails for PDF and office files; Nextcloud ships image/text previews by default and calls the others optional for security reasons (research-nextcloud-files.md). **To research and decide when worked on.** Server-side (converter, pdfium per #630's B2) vs client-side generation; cache and its invalidation on save; HEIC licensing; SVG sanitising; cost on large folders; encrypted storage; multi-instance cache (#742). Refs: `scratch/b7e/backlog/gap-v07/research-v07-gaps.md` A13, #630.
Author
Owner

Research done (at d02f2ba1, scratch/b7e/backlog/research-1101.md; claims marked VERIFIED/INFERRED/UNVERIFIED).

Today: tile thumbnails for jpg, png, gif, webp and bmp only, cached as plain JPEGs on local disk (100 MB fixed, main.go:2454). Found on the way: on encrypted instances the thumbnail and converted-PDF caches hold readable copies (not in encryption.md); thumb.go:54-60 opens (and decrypts, audits, leak-marks) the source before checking its cache; raw/convert reads add Recents entries.

Correction to the issue body: OpenCloud makes no PDF or office thumbnails (png, jpg, gif, tiff, bmp, txt, plus HEIC/AVIF since 9.0 with setup); Seafile 13 does PDF via poppler; Nextcloud and ownCloud ship PDF, SVG and office previews off for security.

Recommended: fix the cache order, audit and Recents first; PDF thumbnails on the server with pdfium in WebAssembly (the #629 B2 fallback); office files show the thumbnail they already carry (ODF always has one), converter rendering as an opt-in switch; SVG never parsed on the server, served to an <img> with sandbox headers; HEIC native in Safari now, a server decoder only after a patent check; caches encrypted with an in-memory key, dropped with the file, one per instance.

Decisions follow.

**Research done** (at d02f2ba1, `scratch/b7e/backlog/research-1101.md`; claims marked VERIFIED/INFERRED/UNVERIFIED). Today: tile thumbnails for jpg, png, gif, webp and bmp only, cached as plain JPEGs on local disk (100 MB fixed, `main.go:2454`). Found on the way: on encrypted instances the thumbnail and converted-PDF caches hold readable copies (not in `encryption.md`); `thumb.go:54-60` opens (and decrypts, audits, leak-marks) the source before checking its cache; raw/convert reads add Recents entries. Correction to the issue body: OpenCloud makes no PDF or office thumbnails (png, jpg, gif, tiff, bmp, txt, plus HEIC/AVIF since 9.0 with setup); Seafile 13 does PDF via poppler; Nextcloud and ownCloud ship PDF, SVG and office previews off for security. Recommended: fix the cache order, audit and Recents first; PDF thumbnails on the server with pdfium in WebAssembly (the #629 B2 fallback); office files show the thumbnail they already carry (ODF always has one), converter rendering as an opt-in switch; SVG never parsed on the server, served to an `<img>` with sandbox headers; HEIC native in Safari now, a server decoder only after a patent check; caches encrypted with an in-memory key, dropped with the file, one per instance. Decisions follow.
Author
Owner

Decided (Nikola, 2026-11-08), all as recommended:

  • PDF thumbnails on the server with pdfium in WebAssembly; the details pane uses the same thumbnail at once.
  • Encrypt both caches (thumbnails and converted PDFs) with an in-memory key; a restart drops them; documented in encryption.md.
  • HEIC and AVIF: shown natively where the browser can (Safari); a server decoder later, after a patent check, behind a switch off by default.
  • First fixes: check the cache before opening the source; no Recents or leak marking for thumbnail reads, audit only when a thumbnail is actually rendered; thumbnails dropped with the file; no-cache with ETag; configurable cache size; one cache per instance.
  • Office: the thumbnail the file carries (ODF always, OOXML when present); rendering through the converter is an opt-in admin switch.
  • SVG: never parsed on the server; the bytes go to an <img> with the sandbox headers.
  • Fix the handbook drift on which formats the converter handles.
**Decided (Nikola, 2026-11-08), all as recommended:** - PDF thumbnails on the server with pdfium in WebAssembly; the details pane uses the same thumbnail at once. - Encrypt both caches (thumbnails and converted PDFs) with an in-memory key; a restart drops them; documented in encryption.md. - HEIC and AVIF: shown natively where the browser can (Safari); a server decoder later, after a patent check, behind a switch off by default. - First fixes: check the cache before opening the source; no Recents or leak marking for thumbnail reads, audit only when a thumbnail is actually rendered; thumbnails dropped with the file; `no-cache` with ETag; configurable cache size; one cache per instance. - Office: the thumbnail the file carries (ODF always, OOXML when present); rendering through the converter is an opt-in admin switch. - SVG: never parsed on the server; the bytes go to an `<img>` with the sandbox headers. - Fix the handbook drift on which formats the converter handles.
Author
Owner

Mockup approved (Nikola, 2026-11-08): 1101-document-thumbnails-mockup.html, all frames, and the open points as recommended: a Previews tab under Document editor; two switches (PDF on, converter rendering off); cache size in configuration only (preview.thumbCacheMB, default 200), shown read-only; the details pane keeps today's one-file conversion for office files without their own picture, tiles never convert; the vendored pdf.js goes in the same change; no type badge on photos; 640 px long side for document pages, 480 px for photos; AVIF to every browser that passes the feature test; no "Clear preview cache" button in v0.7.

**Mockup approved (Nikola, 2026-11-08):** `1101-document-thumbnails-mockup.html`, all frames, and the open points as recommended: a Previews tab under Document editor; two switches (PDF on, converter rendering off); cache size in configuration only (`preview.thumbCacheMB`, default 200), shown read-only; the details pane keeps today's one-file conversion for office files without their own picture, tiles never convert; the vendored pdf.js goes in the same change; no type badge on photos; 640 px long side for document pages, 480 px for photos; AVIF to every browser that passes the feature test; no "Clear preview cache" button in v0.7.
Author
Owner

Shipped in v0.6.404 (PR #1146, merge 6a086e92), live on both dogfoods at 512Mi with GOMEMLIMIT 483183820 (homelab-config 83439bf). Start log on both: converted-PDF and thumbnail caches sealed=true, the v0.6.403 plaintext caches removed (enc: 1 + 4 files, openbao: 7 + 2).

What shipped: server-side PDF thumbnails with PDFium (go-pdfium v1.21.4 on wazero v1.12.0, compiler only) in a per-render sandbox (fresh instance, nothing mounted, 128 MiB, 10 s, watchdog, at most 2 stuck renders), office embedded pictures, converter path with backoff, sealed path-indexed caches (preview.thumbCacheMB 200), pod-local compile cache (preview.pdfCompileCacheDir, default /tmp/cairn-pdfium, marker by the wasm sha256), decoded-picture budget 96 MiB, tiles with type badge and reasons, pane hero button, Administration › Document editor › Previews tab with the memory warning; pdf.js removed (-1.69 MB amd64; net +9.4 MB with PDFium); chart 0.7.0 with memory 512Mi and goMemLimit: auto.

Decided 2026-11-09: approved stuck-render rule kept (residual documented on the security page). New strings approved: pvaMemLow, thWhyBig (plus pvaPdfUnavail, pvOpenName, errNoConverter from the spec). Halo over pictures 85 % (75 % fell below 3:1).

Follow-ups: #1147 (go-pdfium per-module reader table, build recipe), #1148 (licence notice open points, before v0.8), #1149. #742 residuals M1-M4 (cache drops only where the change journal saw the change, per-instance notes and converter backoff, switch reaches others with their settings refresh, card shows the answering instance).

Shipped in **v0.6.404** (PR #1146, merge 6a086e92), live on both dogfoods at 512Mi with GOMEMLIMIT 483183820 (homelab-config 83439bf). Start log on both: converted-PDF and thumbnail caches `sealed=true`, the v0.6.403 plaintext caches removed (enc: 1 + 4 files, openbao: 7 + 2). What shipped: server-side PDF thumbnails with PDFium (go-pdfium v1.21.4 on wazero v1.12.0, compiler only) in a per-render sandbox (fresh instance, nothing mounted, 128 MiB, 10 s, watchdog, at most 2 stuck renders), office embedded pictures, converter path with backoff, sealed path-indexed caches (`preview.thumbCacheMB` 200), pod-local compile cache (`preview.pdfCompileCacheDir`, default /tmp/cairn-pdfium, marker by the wasm sha256), decoded-picture budget 96 MiB, tiles with type badge and reasons, pane hero button, Administration › Document editor › Previews tab with the memory warning; pdf.js removed (-1.69 MB amd64; net +9.4 MB with PDFium); chart 0.7.0 with memory 512Mi and `goMemLimit: auto`. Decided 2026-11-09: approved stuck-render rule kept (residual documented on the security page). New strings approved: pvaMemLow, thWhyBig (plus pvaPdfUnavail, pvOpenName, errNoConverter from the spec). Halo over pictures 85 % (75 % fell below 3:1). Follow-ups: #1147 (go-pdfium per-module reader table, build recipe), #1148 (licence notice open points, before v0.8), #1149. #742 residuals M1-M4 (cache drops only where the change journal saw the change, per-instance notes and converter backoff, switch reaches others with their settings refresh, card shows the answering instance).
Cordy closed this issue 2026-11-09 04:22:24 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1101
No description provided.