POK-53: 支持:飞书文件与语音附件本地持久化#59
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7152fe90e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| type: descriptor.kind === "audio" ? "audio" : "file", | ||
| }, |
There was a problem hiding this comment.
Request audio resources with
file type
The new audio download path calls messageResource.get with params.type: "audio", but the IM resource API accepts image or file (audio/video are fetched via file). In real audio-message traffic this causes the fetch to fail and no local asset is persisted, so the main feature in this commit is broken for audio inputs.
Useful? React with 👍 / 👎.
| async function readLarkResourceBuffer(stream: NodeJS.ReadableStream): Promise<Buffer> { | ||
| const chunks: Buffer[] = []; | ||
| for await (const chunk of stream) { |
There was a problem hiding this comment.
Avoid buffering full inbound files in memory
This implementation reads each attachment stream fully into a Buffer before writing it to disk. For large file/media uploads, that can cause high memory spikes or OOM in the inbound worker, because Buffer.concat materializes the entire payload at once; streaming directly to a file (with backpressure and optional size limits) is needed for reliable production handling.
Useful? React with 👍 / 👎.
这次 PR 的定位