mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
fix: Inline attachments are not counted as attachments and are not shown when searching for emails with attachments.
This commit is contained in:
@@ -180,7 +180,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn many_small_mails() {
|
fn many_small_mails() {
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
for i in 0..1000 {
|
for _ in 0..1000 {
|
||||||
data.extend_from_slice(b"From a\nx\n");
|
data.extend_from_slice(b"From a\nx\n");
|
||||||
}
|
}
|
||||||
let e = collect_entries(&data);
|
let e = collect_entries(&data);
|
||||||
@@ -203,8 +203,6 @@ mod tests {
|
|||||||
determine_folder(labels)
|
determine_folder(labels)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ pub fn extract_envelope(fetch: &Fetch, account_id: u64, mailbox_id: u64) -> Bich
|
|||||||
|
|
||||||
let attachments: Vec<String> = message
|
let attachments: Vec<String> = message
|
||||||
.attachments()
|
.attachments()
|
||||||
|
.filter(|att| {
|
||||||
|
let disp = att.content_disposition();
|
||||||
|
let is_inline = disp.map(|d| d.is_inline()).unwrap_or(false);
|
||||||
|
let has_filename = att.attachment_name().is_some();
|
||||||
|
has_filename && !is_inline
|
||||||
|
})
|
||||||
.filter_map(|att| att.attachment_name())
|
.filter_map(|att| att.attachment_name())
|
||||||
.map(|name| name.to_string())
|
.map(|name| name.to_string())
|
||||||
.collect();
|
.collect();
|
||||||
@@ -195,6 +201,12 @@ pub fn extract_envelope_from_eml(
|
|||||||
|
|
||||||
let attachments: Vec<String> = message
|
let attachments: Vec<String> = message
|
||||||
.attachments()
|
.attachments()
|
||||||
|
.filter(|att| {
|
||||||
|
let disp = att.content_disposition();
|
||||||
|
let is_inline = disp.map(|d| d.is_inline()).unwrap_or(false);
|
||||||
|
let has_filename = att.attachment_name().is_some();
|
||||||
|
has_filename && !is_inline
|
||||||
|
})
|
||||||
.filter_map(|att| att.attachment_name())
|
.filter_map(|att| att.attachment_name())
|
||||||
.map(|name| name.to_string())
|
.map(|name| name.to_string())
|
||||||
.collect();
|
.collect();
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ impl ImportEmls {
|
|||||||
|
|
||||||
let total = request.emls.len();
|
let total = request.emls.len();
|
||||||
for (index, eml_base64) in request.emls.into_iter().enumerate() {
|
for (index, eml_base64) in request.emls.into_iter().enumerate() {
|
||||||
// 1. Decode Base64
|
|
||||||
let decoded = match base64_decode_url_safe!(eml_base64.as_bytes()) {
|
let decoded = match base64_decode_url_safe!(eml_base64.as_bytes()) {
|
||||||
Ok(bytes) => bytes,
|
Ok(bytes) => bytes,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user