mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
Filbytes fix (#85)
* test(sqlite): add some tests for houskeeping methods * fix(tools): handle faile metadata call
This commit is contained in:
committed by
Lars-Magnus Skog
parent
41cecb32c7
commit
e383752b67
@@ -1323,11 +1323,14 @@ pub unsafe fn dc_get_filebytes(
|
||||
return 0;
|
||||
}
|
||||
|
||||
let filebytes = {
|
||||
let p = std::ffi::CStr::from_ptr(pathNfilename_abs)
|
||||
.to_str()
|
||||
.unwrap();
|
||||
fs::metadata(p).unwrap().len()
|
||||
let p = std::ffi::CStr::from_ptr(pathNfilename_abs)
|
||||
.to_str()
|
||||
.unwrap();
|
||||
let filebytes = match fs::metadata(p) {
|
||||
Ok(meta) => meta.len(),
|
||||
Err(_err) => {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
free(pathNfilename_abs as *mut libc::c_void);
|
||||
|
||||
Reference in New Issue
Block a user