Commit 61fa72f1 authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Image: Don't try to load thumbs from non remote paths

Images sent from fractal was using the local path as thumbnail,
something like /tmp/fractal_RANDOM.png, that's the reason why the image
thumbs are not shown in the history.

This patch don't try to load thumbnails that are not mxc://,
http or https and will fallback to the msg full image instead.

Fix #572
parent ffc09548
Pipeline #142873 passed with stages
in 49 minutes and 18 seconds
......@@ -339,8 +339,9 @@ impl MessageBox {
let bx = gtk::Box::new(gtk::Orientation::Horizontal, 0);
let img_path = match msg.thumb {
Some(ref m) => m.clone(),
None => msg.url.clone().unwrap_or_default(),
// If the thumbnail is not a valid URL we use the msg.url
Some(ref m) if m.starts_with("mxc:") || m.starts_with("http") => m.clone(),
_ => msg.url.clone().unwrap_or_default(),
};
let image = widgets::image::Image::new(&self.backend, self.server_url.clone(), &img_path)
.size(Some(globals::MAX_IMAGE_SIZE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment