mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
store chat image by filename,
same as all other blobs also deduplicate blobs before saving
This commit is contained in:
@@ -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 = Chat::load_from_db(context, chat_id).unwrap();
|
||||||
let chat_avatar = match chat.get_profile_image(context) {
|
let chat_avatar = match chat.get_profile_image(context) {
|
||||||
Some(img) => {
|
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());
|
blobs.push(path.clone());
|
||||||
format!("<img class=\"avatar\" src=\"blobs/{}\" />", path)
|
format!("<img class=\"avatar\" src=\"blobs/{}\" />", 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
|
// 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)
|
// (those can be linked from the messages, they are stored in msg_info/[msg-id].txt)
|
||||||
|
|
||||||
|
blobs.dedup();
|
||||||
ExportChatResult {
|
ExportChatResult {
|
||||||
html: format!(
|
html: format!(
|
||||||
"<html>\
|
"<html>\
|
||||||
|
|||||||
Reference in New Issue
Block a user