feat: Deduplicate blob files in chat.rs, config.rs, and integration.rs

These were the last places in the `deltachat` crate where files were
stored without deduplication. The CFFI python bindings are the last
thing that's still missing.
This commit is contained in:
Hocuri
2025-01-24 20:08:20 +01:00
parent 1fd6d80e6d
commit e6ea09641a
5 changed files with 19 additions and 8 deletions

View File

@@ -4170,7 +4170,11 @@ pub async fn set_chat_profile_image(
msg.param.remove(Param::Arg);
msg.text = stock_str::msg_grp_img_deleted(context, ContactId::SELF).await;
} else {
let mut image_blob = BlobObject::new_from_path(context, Path::new(new_image)).await?;
let mut image_blob = BlobObject::create_and_deduplicate(
context,
Path::new(new_image),
Path::new(new_image),
)?;
image_blob.recode_to_avatar_size(context).await?;
chat.param.set(Param::ProfileImage, image_blob.as_name());
msg.param.set(Param::Arg, image_blob.as_name());