From c0b0ac34890f3fbde6a33635c2732a12c67f274b Mon Sep 17 00:00:00 2001 From: lisry-1 Date: Fri, 6 Nov 2026 11:27:36 +0800 Subject: [PATCH] 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 --- backend/app/channels/feishu.py | 3 +++ backend/tests/test_feishu_parser.py | 1 + 2 files changed, 4 insertions(+) diff --git a/backend/app/channels/feishu.py b/backend/app/channels/feishu.py index 9ba97e233c..ee2e14fd7d 100644 --- a/backend/app/channels/feishu.py +++ b/backend/app/channels/feishu.py @@ -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( diff --git a/backend/tests/test_feishu_parser.py b/backend/tests/test_feishu_parser.py index 333c5cb35e..2b6188eb63 100644 --- a/backend/tests/test_feishu_parser.py +++ b/backend/tests/test_feishu_parser.py @@ -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())