feat(normalize): render post attachment zone in convertPost - #18
Open
yjhcjykwbk-jlsec wants to merge 1 commit into
Open
feat(normalize): render post attachment zone in convertPost#18yjhcjykwbk-jlsec wants to merge 1 commit into
yjhcjykwbk-jlsec wants to merge 1 commit into
Conversation
The rich-text attachment zone (top-level files array) was ignored by the post converter: only the locale document (title/content) was flattened and scanned for resources, so attachments attached to a rich-text message were invisible to channel consumers. - render attachment-zone files as <file key=... name=.../> lines and is_folder entries as <folder .../> lines, matching the standalone file/folder converters - surface attachment-zone files as ResourceDescriptor(type=file) so they are downloadable; folders remain tag-only like the folder converter - cover with tests: rendering + resource extraction, empty files array
yjhcjykwbk-jlsec
force-pushed
the
feat/post-attachment-zone
branch
from
August 31, 2026 09:30
e4d7480 to
aa84321
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The rich-text attachment zone (top-level
filesarray on a post message) was ignored byconvertPost: only the locale document (title/content/content_v2) was flattened and scanned for resources, so attachments attached to a rich-text message were invisible to channel consumers (agents/CLIs).This PR makes the attachment zone visible and downloadable:
src/normalize/converters/post.tstopLevelAttachments(): extract the top-levelfiles: [{file_key, file_name, is_folder}]array<file key="..." name="..."/>/<folder key="..." name="..."/>lines after the body, matching the standalone file/folder convertersResourceDescriptor(type: 'file')so they are downloadable; folders stay tag-only (mirrors the standalone folder converter'sresources: [])src/normalize/__tests__/converters.test.ts: two new tests — rendering + resource extraction, and emptyfilesarray toleranceWire shape
{ "zh_cn": { "title": "报告", "content": [...] }, "files": [ { "file_key": "file_a", "file_name": "report.pdf" }, { "file_key": "dir_1", "file_name": "assets", "is_folder": true } ] }renders as:
with
resources: [{type: 'file', fileKey: 'file_a', fileName: 'report.pdf'}].Test