From c8dec0dcddbeef73e451c0f625a55515d55233a7 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Mon, 2 Feb 2026 05:23:23 -0300 Subject: [PATCH] feat: Don't call BlobObject::create_and_deduplicate() when forwarding message to the same account It has a really complex logic, so it's better to avoid calling it if possible than think which side effects and performance penalties it has. It was never called here before adding forwarding messages across contexts (accounts). --- src/chat.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index 27750d644..e51171dc9 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4379,7 +4379,9 @@ pub async fn forward_msgs_2ctx( // When forwarding between different accounts, blob files must be physically copied // because each account has its own blob directory. - if let Some(src_path) = param.get_file_path(ctx_src)? { + if ctx_src.blobdir == ctx_dst.blobdir { + msg.param.steal(param, Param::File); + } else if let Some(src_path) = param.get_file_path(ctx_src)? { let new_blob = BlobObject::create_and_deduplicate(ctx_dst, &src_path, &src_path) .context("Failed to copy blob file to destination account")?; msg.param.set(Param::File, new_blob.as_name());