mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 00:46:30 +03:00
feat: Deduplicate in more places (#6464)
Deduplicate: - In the REPL - In `store_from_base64()`, which writes avatars received in headers - In a few tests - The saved messages, broadcast, device, archive icons - The autocrypt setup message 1-2 more PRs, and we can get rid of `BlobObject::create`, `sanitise_name()`, and some others
This commit is contained in:
@@ -26,12 +26,11 @@ pub async fn initiate_key_transfer(context: &Context) -> Result<String> {
|
||||
/* this may require a keypair to be created. this may take a second ... */
|
||||
let setup_file_content = render_setup_file(context, &setup_code).await?;
|
||||
/* encrypting may also take a while ... */
|
||||
let setup_file_blob = BlobObject::create(
|
||||
let setup_file_blob = BlobObject::create_and_deduplicate_from_bytes(
|
||||
context,
|
||||
"autocrypt-setup-message.html",
|
||||
setup_file_content.as_bytes(),
|
||||
)
|
||||
.await?;
|
||||
"autocrypt-setup-message.html",
|
||||
)?;
|
||||
|
||||
let chat_id = ChatId::create_for_contact(context, ContactId::SELF).await?;
|
||||
let mut msg = Message {
|
||||
@@ -39,6 +38,8 @@ pub async fn initiate_key_transfer(context: &Context) -> Result<String> {
|
||||
..Default::default()
|
||||
};
|
||||
msg.param.set(Param::File, setup_file_blob.as_name());
|
||||
msg.param
|
||||
.set(Param::Filename, "autocrypt-setup-message.html");
|
||||
msg.subject = stock_str::ac_setup_msg_subject(context).await;
|
||||
msg.param
|
||||
.set(Param::MimeType, "application/autocrypt-setup");
|
||||
|
||||
Reference in New Issue
Block a user