From 2969db7e306fb1e4340595dd35ddc3d6a353c58a Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 29 Nov 2024 12:19:47 -0800 Subject: [PATCH] img: include jpeg when detecting images Signed-off-by: William Casarin --- src/ui/note/contents.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/note/contents.rs b/src/ui/note/contents.rs index 78afc59f..a27306cd 100644 --- a/src/ui/note/contents.rs +++ b/src/ui/note/contents.rs @@ -122,6 +122,10 @@ pub fn render_note_preview( .inner } +fn is_image_link(url: &str) -> bool { + url.ends_with("png") || url.ends_with("jpg") || url.ends_with("jpeg") +} + #[allow(clippy::too_many_arguments)] fn render_note_contents( ui: &mut egui::Ui, @@ -184,7 +188,7 @@ fn render_note_contents( BlockType::Url => { let lower_url = block.as_str().to_lowercase(); - if !hide_media && (lower_url.ends_with("png") || lower_url.ends_with("jpg")) { + if !hide_media && is_image_link(&lower_url) { images.push(block.as_str().to_string()); } else { #[cfg(feature = "profiling")]