diff --git a/crates/egui_extras/src/loaders/image_loader.rs b/crates/egui_extras/src/loaders/image_loader.rs index 8c2c497058ad..1a90c7c72062 100644 --- a/crates/egui_extras/src/loaders/image_loader.rs +++ b/crates/egui_extras/src/loaders/image_loader.rs @@ -5,7 +5,7 @@ use egui::{ ColorImage, }; use image::ImageFormat; -use std::{mem::size_of, path::Path, sync::Arc}; +use std::{mem::size_of, sync::Arc}; type Entry = Result, String>; @@ -19,16 +19,11 @@ impl ImageCrateLoader { } fn is_supported_uri(uri: &str) -> bool { - let Some(ext) = Path::new(uri).extension().and_then(|ext| ext.to_str()) else { - // `true` because if there's no extension, assume that we support it - return true; - }; - // Uses only the enabled image crate features ImageFormat::all() .filter(ImageFormat::reading_enabled) .flat_map(ImageFormat::extensions_str) - .any(|format_ext| ext == *format_ext) + .any(|format_ext| uri.contains(*format_ext)) } fn is_unsupported_mime(mime: &str) -> bool {