mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 23:46:31 +03:00
prefer 'if let' over 'unwrap()'
This commit is contained in:
@@ -1309,10 +1309,13 @@ fn get_attachment_filename(mail: &mailparse::ParsedMail) -> Result<Option<String
|
|||||||
// and things should not be totally bad for other encodings.
|
// and things should not be totally bad for other encodings.
|
||||||
// we can tweak that when we see sth. else really used in the wild nowadays.
|
// we can tweak that when we see sth. else really used in the wild nowadays.
|
||||||
let desired_filename = if let Some(name) = desired_filename {
|
let desired_filename = if let Some(name) = desired_filename {
|
||||||
let name = name.splitn(3, '\'').last().unwrap().to_string();
|
if let Some(name) = name.splitn(3, '\'').last() {
|
||||||
Some(percent_decode_str(&name).decode_utf8_lossy().to_string())
|
Some(percent_decode_str(&name).decode_utf8_lossy().to_string())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there is no filename, but part is an attachment, guess filename
|
// If there is no filename, but part is an attachment, guess filename
|
||||||
|
|||||||
Reference in New Issue
Block a user