mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
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).
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user