Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: re-use added image if possible

+13 -1
+13 -1
crates/framework/src/assets.rs
··· 30 30 where 31 31 P: Into<PathBuf>, 32 32 { 33 + let image_path = image_path.into(); 34 + 35 + // Check if the image already exists in the assets, if so, return it 36 + if let Some(image) = self.assets.iter().find_map(|asset| { 37 + asset 38 + .as_any() 39 + .downcast_ref::<Image>() 40 + .filter(|image| image.path == image_path) 41 + }) { 42 + return image.clone(); 43 + } 44 + 33 45 let image = Box::new(Image { 34 - path: image_path.into(), 46 + path: image_path, 35 47 assets_dir: self.assets_dir.clone(), 36 48 }); 37 49