Repository navigation
fix: preserve data URL attachment filename extensions - #130625
Conversation
Carry the normalized MIME into the existing attachment filename inference. Cover PNG/CSV metadata across actions and the real action-to-plugin dispatch boundary. Explicit filenames and MIME overrides remain unchanged. Closes #130618.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for Root cause: the shared attachment hydrator computed the data URL MIME, then inferred filenames from the earlier missing MIME input. The existing filename owner now consumes that normalized fact. Explicit filename/MIME precedence, raw buffers, media access and transport remain unchanged. Production +1/-1; tests +29/-8. Before: 11 intended filename failures, including three action-to-plugin dispatch cases. After: 267 focused tests passed, plus 25 real no-module-mock hydration/precedence cases in isolated temporary state. Exact local commands: OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/infra/outbound/message-action-params.attachments.test.ts src/infra/outbound/message-action-params.test.ts packages/media-core/src/mime.test.tspnpm check:changedgit diff --checkFresh independent P1 autoreview is clean (correct, confidence 0.94). Current-main comparison found no affected owner/test drift. The PR body retains the concrete proof gap: no isolated iMessage recipient/account was provisioned, so recipient rendering/group-icon acceptance and chat screenshots were not verified. Core metadata and plugin-handler proof is not described as live channel delivery; no external API or transport changed. The latest ClawSweeper comment remains a review-started placeholder, with no published verdict/rank-up list; it is not counted as completed review. Proceeding with the completed independent review, exact-head proof, and native hosted-CI landing gates. |
|
Merged via squash.
|
Carry the normalized MIME into the existing attachment filename inference. Cover PNG/CSV metadata across actions and the real action-to-plugin dispatch boundary. Explicit filenames and MIME overrides remain unchanged. Closes openclaw#130618.
Closes #130618
What Problem This Solves
Fixes an issue where attachment actions using valid data URL buffers produced filenames such as
attachmentinstead ofattachment.pngorattachment.csv, even though the content type had already been recognized. Ordinarysenddid not have this filename defect.Why This Change Was Made
The shared attachment hydrator extracted MIME from the data URL, then inferred the filename from the earlier, missing input MIME. Filename inference now consumes the normalized MIME already owned by that hydrator. This reuses the existing normalizer and filename helper; it adds no new branch, channel-specific handling, dependency, or fallback.
User Impact
sendAttachment,reply,upload-file, and shared group-icon attachment normalization retain the expected MIME-derived filename extension. Explicit filenames and content types still take precedence, and raw base64 naming behavior is unchanged. Buffer decoding, media access policy, sandboxing, delivery, and persistent state are untouched.Evidence
Before the production edit, 11 regression assertions failed: PNG/CSV filename inference across four attachment actions, plus existing action-runner dispatch fixtures for sendAttachment, upload-file, and reply. All failures received
attachmentinstead of the expected MIME-derived filename. Ordinary-send controls and explicit content-type controls passed.After the one-line producer repair, 267 tests passed across the two hydration/runner suites and the shared MIME suite:
OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test src/infra/outbound/message-action-params.attachments.test.ts src/infra/outbound/message-action-params.test.ts packages/media-core/src/mime.test.tsAll passed. Changed checks include formatting, type checks, lint, import-cycle and architecture guards. A separate Node process with temporary HOME/config/state and no module mocks passed 25 real hydration cases: data URL, explicit filename, explicit MIME, raw base64 with MIME, and raw base64 without MIME across all five actions.
Fresh independent P1 autoreview found no actionable findings (correct, confidence 0.94). Exact-head CI 33034708529 is green on
6bd02709b140456ccd666a6a30477801c22e8999; native review artifacts validate atREADY FOR /prepare-pr. Production +1/-1, net zero; tests +29/-8. Coverage extends existing tables and dispatch fixtures, with no test-only production seam.The latest ClawSweeper comment is still a review-started placeholder; no verdict or rank-up list has been published. It is not counted as completed review. The independent review and exact-head proof above are complete.
Proof limit: this is real core hydration and existing plugin-handler boundary proof, not a claim of live recipient delivery. No isolated iMessage recipient/account was provisioned; native recipient rendering, group-icon acceptance, and chat screenshots are therefore unverified. No external API or channel transport behavior changed. The group-icon CSV case checks the shared normalizer only, not that a recipient accepts CSV icons.
No docs contract or public options change. Existing documentation already accepts buffer/filename attachment inputs; release-note context is the restored inferred extensions described above. No changelog file edit. AI-assisted repair.