mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
try fix filename encoding bug -- fails in one test
This commit is contained in:
@@ -579,14 +579,23 @@ impl<'a> MimeParser<'a> {
|
||||
// `Content-Disposition: ... filename*=...`
|
||||
// or `Content-Disposition: ... filename*0*=... filename*1*=... filename*2*=...`
|
||||
// or `Content-Disposition: ... filename=...`
|
||||
use quoted_printable::ParseMode::Robust;
|
||||
|
||||
let ct = mail.get_content_disposition()?;
|
||||
let mut desired_filename = ct
|
||||
.params
|
||||
.iter()
|
||||
.filter(|(key, _value)| key.starts_with("filename"))
|
||||
.fold(String::new(), |mut acc, (_key, value)| {
|
||||
acc += value;
|
||||
.fold(String::new(), |mut acc, (key, value)| {
|
||||
if key.starts_with("filename*") {
|
||||
quoted_printable::decode(&value, Robust)
|
||||
.map(|ref res| {
|
||||
acc += &String::from_utf8_lossy(res);
|
||||
})
|
||||
.ok();
|
||||
} else {
|
||||
acc += value;
|
||||
};
|
||||
acc
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user