commit 19e671ff25bffa47424b5af44264c2c74c2cc84b
parent 60964c07e6d178ae632d821e5698eee681f3d3c7
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Mon, 3 Jul 2023 20:20:26 +0200
Fix dataurl parse panic when icon is malformed
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api/icons.rs b/src/api/icons.rs
@@ -682,7 +682,7 @@ async fn download_icon(domain: &str) -> Result<(Bytes, Option<&str>), Error> {
for icon in icon_result.iconlist.iter().take(5) {
if icon.href.starts_with("data:image") {
- let datauri = DataUrl::process(&icon.href).unwrap();
+ let Ok(datauri) = DataUrl::process(&icon.href) else {continue};
// Check if we are able to decode the data uri
let mut body = BytesMut::new();
match datauri.decode::<_, ()>(|bytes| {