Files
OpenMAIC/lib/document
6a8db813bb refactor(upload): derive the workbench material MIME policy from the shared format registry (#1590)
* refactor(upload): derive the workbench material MIME policy from the shared format registry

#1498 fixed the Kylin generic-Office-MIME failure on both upload paths but
left the workbench with its own extension→MIME table, alias map, and
generic-MIME set next to the document registry, and the two had already
drifted. The workbench policy now derives every MIME/extension fact from
lib/document/mime.ts (the single source of truth); only the accepted-format
list stays workbench policy — fixed and extractor-independent, unlike the
classic path's provider-scoped whitelist.

- Register csv and webm in DOCUMENT_FORMATS (accepted by no document
  provider, so classic-mode whitelists are unchanged) and add the
  audio/x-m4a alias to m4a.
- material-upload-policy.ts keeps its export names (route, session-store,
  and composer consumers unchanged) but resolves, whitelists, and builds
  its accept string from registry helpers.
- The workbench gate now also accepts the registry's curated aliases it
  previously missed: image/jpg, text/x-markdown, and audio/x-wav (stored
  canonically as audio/wav).

Closes #1589.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* test(workbench): pin the audio/mp3 alias closure in the material policy

Deriving the workbench gate from the shared registry normalization
(#1589) also accepts the browser-reported audio/mp3 alias the hand-rolled
alias map rejected — the same gap class as image/jpg and text/x-markdown,
so pin it alongside them and name it in the comment.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: wyuc <wang-yc24@mails.tsinghua.edu.cn>
2026-09-19 21:49:56 +08:00
..