From b3eaf6730fbe38ba49b6db220205f4b7ec61e450 Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Thu, 7 May 2020 00:34:23 +0200 Subject: [PATCH] store chat image by filename, same as all other blobs also deduplicate blobs before saving --- src/export_chat.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/export_chat.rs b/src/export_chat.rs index b19375403..809c300fd 100644 --- a/src/export_chat.rs +++ b/src/export_chat.rs @@ -149,7 +149,9 @@ pub fn export_chat(context: &Context, chat_id: ChatId) -> ExportChatResult { let chat = Chat::load_from_db(context, chat_id).unwrap(); let chat_avatar = match chat.get_profile_image(context) { Some(img) => { - let path = img.to_str().unwrap().to_owned(); + let path = img.file_name() + .unwrap_or_else(|| std::ffi::OsStr::new("")) + .to_str().unwrap().to_owned(); blobs.push(path.clone()); format!("", path) }, @@ -164,6 +166,7 @@ pub fn export_chat(context: &Context, chat_id: ChatId) -> ExportChatResult { // todo export message infos and save them to txt files // (those can be linked from the messages, they are stored in msg_info/[msg-id].txt) + blobs.dedup(); ExportChatResult { html: format!( "\