mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 06:56:29 +03:00
Add timestamps to images and videos
It is already done for voice messages and makes saving attachments to one folder easier.
This commit is contained in:
committed by
link2xt
parent
66907c17d3
commit
deb506cb52
@@ -1141,13 +1141,23 @@ async fn build_body_file(
|
||||
Viewtype::Image | Viewtype::Gif => format!(
|
||||
"{}.{}",
|
||||
if base_name.is_empty() {
|
||||
"image"
|
||||
chrono::Utc
|
||||
.timestamp(msg.timestamp_sort as i64, 0)
|
||||
.format("image_%Y-%m-%d_%H-%M-%S")
|
||||
.to_string()
|
||||
} else {
|
||||
base_name
|
||||
base_name.to_string()
|
||||
},
|
||||
&suffix,
|
||||
),
|
||||
Viewtype::Video => format!("video.{}", &suffix),
|
||||
Viewtype::Video => format!(
|
||||
"video_{}.{}",
|
||||
chrono::Utc
|
||||
.timestamp(msg.timestamp_sort as i64, 0)
|
||||
.format("%Y-%m-%d_%H-%M-%S")
|
||||
.to_string(),
|
||||
&suffix
|
||||
),
|
||||
_ => blob.as_file_name().to_string(),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user