Skip to content

Commit 0cadfe3

Browse files
authored
refactor: Remove unused parameter and return value from build_body_file(…) (#6369)
2 simple refactoring commits that remove some unused code.
1 parent 137e32f commit 0cadfe3

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/mimefactory.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ impl MimeFactory {
13691369

13701370
// add attachment part
13711371
if msg.viewtype.has_file() {
1372-
let (file_part, _) = build_body_file(context, &msg, "").await?;
1372+
let file_part = build_body_file(context, &msg).await?;
13731373
parts.push(file_part);
13741374
}
13751375

@@ -1509,11 +1509,7 @@ pub(crate) fn wrapped_base64_encode(buf: &[u8]) -> String {
15091509
.join("\r\n")
15101510
}
15111511

1512-
async fn build_body_file(
1513-
context: &Context,
1514-
msg: &Message,
1515-
base_name: &str,
1516-
) -> Result<(PartBuilder, String)> {
1512+
async fn build_body_file(context: &Context, msg: &Message) -> Result<PartBuilder> {
15171513
let blob = msg
15181514
.param
15191515
.get_blob(Param::File, context)
@@ -1539,17 +1535,13 @@ async fn build_body_file(
15391535
),
15401536
Viewtype::Image | Viewtype::Gif => format!(
15411537
"image_{}.{}",
1542-
if base_name.is_empty() {
1543-
chrono::Utc
1544-
.timestamp_opt(msg.timestamp_sort, 0)
1545-
.single()
1546-
.map_or_else(
1547-
|| "YY-mm-dd_hh:mm:ss".to_string(),
1548-
|ts| ts.format("%Y-%m-%d_%H-%M-%S").to_string(),
1549-
)
1550-
} else {
1551-
base_name.to_string()
1552-
},
1538+
chrono::Utc
1539+
.timestamp_opt(msg.timestamp_sort, 0)
1540+
.single()
1541+
.map_or_else(
1542+
|| "YY-mm-dd_hh:mm:ss".to_string(),
1543+
|ts| ts.format("%Y-%m-%d_%H-%M-%S").to_string(),
1544+
),
15531545
&suffix,
15541546
),
15551547
Viewtype::Video => format!(
@@ -1601,7 +1593,7 @@ async fn build_body_file(
16011593
.header(("Content-Transfer-Encoding", "base64"))
16021594
.body(encoded_body);
16031595

1604-
Ok((mail, filename_to_send))
1596+
Ok(mail)
16051597
}
16061598

16071599
async fn build_avatar_file(context: &Context, path: &str) -> Result<String> {

0 commit comments

Comments
 (0)