mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
fix: do not ignore errors in try_calc_and_set_dimensions
This commit is contained in:
@@ -583,14 +583,22 @@ impl Message {
|
|||||||
if (self.viewtype == Viewtype::Image || self.viewtype == Viewtype::Gif)
|
if (self.viewtype == Viewtype::Image || self.viewtype == Viewtype::Gif)
|
||||||
&& !self.param.exists(Param::Width)
|
&& !self.param.exists(Param::Width)
|
||||||
{
|
{
|
||||||
self.param.set_int(Param::Width, 0);
|
let buf = read_file(context, &path_and_filename).await?;
|
||||||
self.param.set_int(Param::Height, 0);
|
|
||||||
|
|
||||||
if let Ok(buf) = read_file(context, path_and_filename).await {
|
match get_filemeta(&buf) {
|
||||||
if let Ok((width, height)) = get_filemeta(&buf) {
|
Ok((width, height)) => {
|
||||||
self.param.set_int(Param::Width, width as i32);
|
self.param.set_int(Param::Width, width as i32);
|
||||||
self.param.set_int(Param::Height, height as i32);
|
self.param.set_int(Param::Height, height as i32);
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
self.param.set_int(Param::Width, 0);
|
||||||
|
self.param.set_int(Param::Height, 0);
|
||||||
|
warn!(
|
||||||
|
context,
|
||||||
|
"Failed to get width and height for {}: {err:#}.",
|
||||||
|
path_and_filename.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.id.is_unset() {
|
if !self.id.is_unset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user