fix(feishu): clear msg.files after receive_file downloads them (#7804)

receive_file downloaded each image/file descriptor and replaced the
[image]/[file] placeholders in msg.text, but left msg.files intact. The
generic URL-based _ingest_inbound_files pass then re-walked the residual
{"image_key":...}/{"file_key":...} descriptors, found no url, and logged a
spurious 'reader returned no data' warning per file.

Clear msg.files after materializing the paths, matching DingTalk (msg.files =
[]) and the Slack/Telegram/Discord providers (which materialize them).

Co-authored-by: lisry-1 <249596828+lisry-1@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
lisry-1 2026-11-06 11:27:36 +08:00 committed by GitHub
parent e163b02bea
commit c0b0ac3489
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -733,6 +733,9 @@ class FeishuChannel(Channel):
virtual_path = await self._receive_single_file(msg.thread_ts, file["file_key"], "file", thread_id, user_id=user_id)
replace_next_placeholder("[file]", virtual_path)
msg.text = text
# Clear the descriptors so the generic URL-based _ingest_inbound_files
# pass does not try to re-fetch files that were downloaded by key.
msg.files = []
return msg
async def _receive_single_file(

View File

@ -513,6 +513,7 @@ def test_feishu_receive_file_replaces_placeholders_in_order():
result = await channel.receive_file(msg, "thread_1")
assert result.text == "before /mnt/user-data/uploads/a.png middle /mnt/user-data/uploads/b.pdf after"
assert result.files == []
_run(go())