streamline mimetype guessing and build_body_file

This commit is contained in:
holger krekel
2019-09-21 21:19:24 +02:00
parent f6019583b7
commit 9689df601f
5 changed files with 151 additions and 208 deletions

View File

@@ -548,11 +548,11 @@ fn validate_filename(filename: &str) -> String {
// the returned suffix is lower-case
#[allow(non_snake_case)]
pub unsafe fn dc_get_filesuffix_lc(path_filename: impl AsRef<str>) -> *mut libc::c_char {
pub fn dc_get_filesuffix_lc(path_filename: impl AsRef<str>) -> Option<String> {
if let Some(p) = Path::new(path_filename.as_ref()).extension() {
p.to_string_lossy().to_lowercase().strdup()
Some(p.to_string_lossy().to_lowercase())
} else {
ptr::null_mut()
None
}
}