geforkt von mirrored/vaultwarden
Moved function call to get_icon_url to prevent error bubbeling
Dieser Commit ist enthalten in:
Ursprung
9657463717
Commit
da068a43c1
1 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
|
@ -55,10 +55,8 @@ fn get_icon(domain: &str) -> Vec<u8> {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = get_icon_url(&domain).unwrap();
|
|
||||||
|
|
||||||
// Get the icon, or fallback in case of error
|
// Get the icon, or fallback in case of error
|
||||||
match download_icon(&url) {
|
match download_icon(&domain) {
|
||||||
Ok(icon) => {
|
Ok(icon) => {
|
||||||
save_icon(&path, &icon);
|
save_icon(&path, &icon);
|
||||||
icon
|
icon
|
||||||
|
@ -284,9 +282,11 @@ fn fix_href(href: &str, url: &str) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn download_icon(url: &str) -> Result<Vec<u8>, Error> {
|
fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
|
||||||
info!("Downloading icon for {}...", url);
|
let url = get_icon_url(&domain).unwrap();
|
||||||
let mut res = reqwest::get(url)?;
|
|
||||||
|
info!("Downloading icon for {} via {}...",domain, url);
|
||||||
|
let mut res = reqwest::get(&url)?;
|
||||||
|
|
||||||
res = res.error_for_status()?;
|
res = res.error_for_status()?;
|
||||||
|
|
||||||
|
|
Laden …
In neuem Issue referenzieren