Skip to content

[ADD] dms_libreoffice_preview: server-side office→PDF preview handler#8

Closed
dnplkndll wants to merge 0 commit into
19.0-ci-ui-artifactsfrom
19.0-add-dms-libreoffice-preview
Closed

[ADD] dms_libreoffice_preview: server-side office→PDF preview handler#8
dnplkndll wants to merge 0 commit into
19.0-ci-ui-artifactsfrom
19.0-add-dms-libreoffice-preview

Conversation

@dnplkndll
Copy link
Copy Markdown

@dnplkndll dnplkndll commented May 26, 2026

New sibling addon dms_libreoffice_preview — server-side LibreOffice→PDF conversion that plugs into the dms.preview_handlers registry introduced in #3. Fork-only; will be split as a standalone OCA submission once the base dms 19.0.1.0.0 wheel ships.

Base: 19.0-ci-ui-artifacts (#7) · Head: 19.0-add-dms-libreoffice-preview.

Stack: #3 UX → #9 Hoot → #7 CI → this PR.

What the branch adds

  • dms_libreoffice_preview/ — new addon, depends: ["dms"], external_dependencies.deb: ["libreoffice", "fonts-noto", "fonts-liberation"] (OCA CI installs at runtime).
  • Conversion: subprocess.run(["soffice", "--headless", "--convert-to", "pdf", ...]) per-conversion temp dir to avoid .~lock collisions.
  • Cache: child ir.attachment on dms.file keyed by checksum (auto-cascades on file delete; ACL inherits via parent's check_access).
  • Controller: /dms/file/<id>/libreoffice_preview — not readonly=True (writes the cached attachment), uses raise request.not_found() from e for ACL/missing.
  • Frontend handler: LibreofficePreview registered at score 10 (beats built-in OfficeFallbackPreview at 0); renders an <iframe> reusing the existing .o_dms_preview__iframe SCSS class. text/rtf included in OFFICE_MIMETYPES so libmagic's text/rtf reply routes here instead of TextPreview.
  • Tests: Python HttpCase covers happy path, cache hit, invalidation on checksum change, malformed file, ACL denial. Hoot covers registry score + URL composition.

Reviewer notes

  • Subprocess per call is intentional (right for on-demand previews). unoserver daemon mode is a future optimisation.
  • ACL enforced server-side via dms.file.check_access before serving the cached attachment.
  • Cache key is checksum (content-addressed), not write_date — survives write_date bumps from unrelated field writes.

CI

GitHub Actions on the ledoent org is currently throttled. Runboat builds + local --test-enable pass.

@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 756c750 to 8f44070 Compare May 26, 2026 12:22
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 8f44070 to 228d992 Compare May 26, 2026 18:28
@dnplkndll dnplkndll changed the base branch from 19.0-imp-dms-ux to 19.0-ci-ui-artifacts May 26, 2026 18:29
dnplkndll added a commit that referenced this pull request May 26, 2026
Live audit on the PR #8 runboat (2026-05-26) surfaced these defects:

B1 — Sample.md rendered as raw text in the side pane. libmagic returns
text/plain for .md (no magic signature distinguishes it from prose), so
_effectiveMimetype() returned text/plain and TextPreview won over
MarkdownPreview. Add text/plain to _STORED_OVERRIDABLE so the extension
mapping wins for .md / .markdown / .json / .xml / .csv / etc.

B2 / B3 / B4 — Files list view polish:
- Add a leading mime-icon column (icon_url + image_url widget, 24×24)
  so list view matches kanban's scannability.
- Replace the raw mimetype column ("application/vnd.oasis.ope…") with
  the short extension field; rename column header to "Type".
- Set explicit widths on name (320), extension (90), human_size (100),
  write_date (180) so name no longer truncates ("Document…").

B5 — Form hero "TYPE" stat showed lowercase ("svg") while kanban cards
use uppercase ("SVG"). Add &--uppercase modifier on .o_dms_form_hero
__stat_value and apply it to the extension stat.

B9 — Standardise the modified-date column label across list ("Modified")
and form hero ("Modified"); upstream had "Last Updated on" in list.

B10 — Hide the Subdirectories / Files table in the directory form when
empty, reclaiming ~150px of blank rows on leaf directories. The
hero-stat tiles still expose the "+ Add" affordance.
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from ffc5974 to ff016d6 Compare May 26, 2026 18:55
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 228d992 to ae1f2d3 Compare May 26, 2026 18:56
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from ff016d6 to 1f77ff5 Compare May 28, 2026 20:50
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from ae1f2d3 to 6e174c5 Compare May 28, 2026 20:50
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 1f77ff5 to 2029db5 Compare May 28, 2026 21:11
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 6e174c5 to 19a9e23 Compare May 28, 2026 21:11
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 2029db5 to 2b6fe4d Compare May 28, 2026 21:21
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 19a9e23 to 489b89a Compare May 28, 2026 21:21
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 2b6fe4d to 70dcc42 Compare May 28, 2026 23:46
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 489b89a to 20e3f5f Compare May 28, 2026 23:46
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 70dcc42 to f579209 Compare May 28, 2026 23:56
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 20e3f5f to 2d149f3 Compare May 28, 2026 23:56
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from f579209 to 08cec0b Compare May 29, 2026 00:14
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 2d149f3 to d08be1c Compare May 29, 2026 00:14
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 08cec0b to 7246160 Compare May 29, 2026 00:45
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from d08be1c to 6540867 Compare May 29, 2026 00:45
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 7246160 to ce97955 Compare May 29, 2026 01:08
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 6540867 to 4f9a473 Compare May 29, 2026 01:08
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from ce97955 to fa54dfe Compare May 29, 2026 02:58
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 4f9a473 to 623f26e Compare May 29, 2026 02:59
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from fa54dfe to 134e055 Compare May 29, 2026 11:34
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 623f26e to 0a76cf5 Compare May 29, 2026 11:34
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 134e055 to b1cd0fa Compare May 29, 2026 11:49
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 0a76cf5 to 1b13cc3 Compare May 29, 2026 11:49
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from b1cd0fa to 9a2a20e Compare May 29, 2026 12:06
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 1b13cc3 to 9be740b Compare May 29, 2026 12:06
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 9a2a20e to 7c81428 Compare May 29, 2026 14:31
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 9be740b to bf4dec3 Compare May 29, 2026 14:31
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 7c81428 to 349c9e3 Compare May 29, 2026 15:13
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from bf4dec3 to a6dd60b Compare May 29, 2026 15:13
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 349c9e3 to fd2ec7f Compare May 29, 2026 19:36
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from a6dd60b to 58b2a8c Compare May 29, 2026 19:36
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from fd2ec7f to 189291b Compare May 29, 2026 20:52
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 58b2a8c to 937ed8e Compare May 29, 2026 20:52
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 189291b to 362a508 Compare May 30, 2026 00:12
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 937ed8e to 62c0741 Compare May 30, 2026 00:12
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 362a508 to 6d6b3c9 Compare May 30, 2026 01:32
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 62c0741 to 89f37b4 Compare May 30, 2026 01:32
@dnplkndll dnplkndll force-pushed the 19.0-ci-ui-artifacts branch from 6d6b3c9 to d09e8ae Compare May 30, 2026 03:13
@dnplkndll dnplkndll closed this May 30, 2026
@dnplkndll dnplkndll force-pushed the 19.0-add-dms-libreoffice-preview branch from 89f37b4 to d09e8ae Compare May 30, 2026 03:13
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